[Rails] Link_to and Routing
I am a newbie to ruby/rails. I almost don't know anything about rails,
however, I am familiar with MVC3 of ASP.Net. Please help me with this
question as I am about to fail a course. :(
In my routes.rb file I have a nested resource:
root to: "parentitems#index"
resources :parentitemsdo
resources :childitems, only: [:new, :create, :destroy]
end
In my parentitems\show\.html.erb file, I am adding a link and I don't
know how to do that.
Which one of these would do the job, if any?
<%= link_to 'New Childitem', new_parentitem_childitem_url %>
<%= link_to 'New Childitem', new_parentitem_childitem_path %>
and what do I need to specify in the routes.rb file so that this link
goes to the new view for childitems?
Thanks you for the hlep.
--
Posted via http://www.ruby-forum.com/.
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home