ok, i hope, we can fix that one.
but to change to RESTfullness takes a few steps and you can get errors
in different places.
main source of trouble is the routing
no. two are the path methods
so a good approach would be to start with a small dummy project, just to
get used to the way, rails handles those things, before you start
working over a large realworld project
first of all, the RESTfull routes expect that you use those actions:
action path_function method
index plural_path get
show singular_path(id) get
new new_singular_path get
create plural_path post
edit edit_singular_path(id) get
update singular_path(id) put
destroy singular_path(id) delete
the _path functions work on those (but you can still add your own)
simple example: grouped articles:
map.resources :groups do |group|
group.resources :articles
end
this adds the path_prefix group (singular, since it will work on
articles in the selected group)
and the path function will expect now an additional group id
so to show all articles in a group:
group_articles_path(@my_group_id) (this will call the index action of
articles and hand over params[:group_id])
or to show a single article:
group_article_path(@my_group_id, @my_article_id) (this will call the
show action of articles and hand over params[:group_id] and params[:id])
somuch to a very rough overview, you can read more details here:
http://www.b-simple.de/documents
and to your specific error:
The error occurred while evaluating nil.to_sym
this you will get most likely, if your routing doesn’t match with your
path
<%= link_to ‘Add to Favorites’, efav_efavs_path(@user, :eitem =>
@eitem.id)%>
assuming, that @user and @eitem do exist, i can only guess from the path
name,
that you want to show all the efavs of a given efav (whatever an efav is
the routing would look like this: (???)
map.resources :efavs do |efav|
efav.resources :efavs
end
seems a bit strange, but may work for a kind of tree structure
another guess:
user_efavs_path(@user, …)
or is @eitem.id an efav? then David’s gues would be right:
efav_efavs_path(@user, @eitem)
you need the hash syntax only for additional attributes (like the date
in the other example)
sorry, i’m at a loss here, whithout knowing more details about your
project
or what exactly you want to do
and your question:
project_iterations_path(@project_id, :date => @wanted_date)
I assume that “@wanted_date” is an instance variable available on the
current view and “:date” is simply an arbitrary symbol you chose to
use?
yes, thats right. it would show the iterations of a given project
(index) and hand over an additional
parameter date which the action will get as params[:date]
thorsten