babu nair
2008-Oct-30 04:48 UTC
Nested Resouces,not getting parent id(project_id) from form
Hi
i am using nested resources,here project having has many relation with
defects.
Main problem here is i am not getting project_id from edit form.What''s
a
problem if any one knows please help.
edit.html.erb
<% form_for(@defect,@project) do |f| %>
<%=f.text_field :name%>
<%end%>
routes.rb
map.resources :projects,:has_many=>:defects
map.resources :defects
defecs_controller.rb
before_filter :get_project
private
def get_project
@project = Project.find(params[:project_id])
end
def edit
code for update defects
end
Here problem is from edit form i am getting project id.
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Thani Ararsu
2008-Oct-30 05:18 UTC
Re: Nested Resouces,not getting parent id(project_id) from form
babu nair wrote:> Hi > i am using nested resources,here project having has many relation with > defects. > Main problem here is i am not getting project_id from edit form.What''s a > problem if any one knows please help. > > edit.html.erb > <% form_for(@defect,@project) do |f| %>try this <% form_for(@project,@defect) do |f| %>> <%=f.text_field :name%> > <%end%>-- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---