Ok looks like I goofed up on the edit page... but here is what my
link_to looks like now and it works:
<%= link_to "Edit", {:action => "edit", :id =>
product }%>
I guess my only question is this constructs the url like so:
http://localhost/edit/5
But the original (scaffold - product model/products_controller)
produces this:
http://localhost/5/edit
Both work fine - anything to worry about? I''m guessing this would
probably be answered with a better understanding of routes.
On Jan 27, 6:42 pm, longint
<michael.me...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I''m a noob trying to learn 2.0 via the AWDR 1.2 book. What
I''m doing
> is the depot app and I''m trying to follow the admin/store
controller
> way. So right now I have a Product model and I ditched the
> products_controller and views for an admin_controller and views.
>
> I''m getting tripped up on the "edit" link on the product
index page
> view. So if I were using the standard scaffold created by 2.0 my edit
> link in index would like this:
>
> <%= link_to ''Edit'', edit_product_path(product) %>
>
> And that would link tohttp://localhost/5/edit(assuming we''re
> clicking product id of 5)
>
> But that is when there''s a products_controller. However, I have
an
> admin_controller. What would my link_to look like for that to work
> correctly? Everything I try gives me a undefined method error telling
> me to stringify_keys! And after doing some research it''s because
I''m
> sending a string value when it expects a hash. And my url string is a
> bit different:http://localhost/edit/5instead ofhttp://localhost/5/edit.
> I''m lost :)
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---