A restful way might be something like this:
/widgets?category_id=23
Then you could pass that param in your link:
<%= link_to "New Widget", new_widget_path(:category_id =>
params[:category_id) %>
Which would get you something like:
/widgets/new?category_id=23
And in your controller:
def new
@widget = Widget.new
@widget.category_id = params[:category_id]
end
That would be slick!
-Nathan
Javan Makhmali wrote:
is there an easy way to get information about the referring page?
specifically, i'm trying to detect which Category a user was browsing
in when the clicked a "new" link and than adjust the Category select
field accordingly.
javan
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby