Closed nrc0004 closed 7 years ago
What do you mean by child model? Do you have resources for exercise nested in resources for programs?
yes, sorry, its my dependent model I guess?
And yes, I do have them nested.
On Feb 27, 2017, at 2:41 PM, Nayana Davis notifications@github.com wrote:
What do you mean by child model? Do you have resources for exercise nested in resources for programs?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ga-wdi-exercises/project2/issues/819#issuecomment-282829200, or mute the thread https://github.com/notifications/unsubscribe-auth/AXqfmeltgkA6YHoQB7TFgLID9K8AsjNDks5rgybigaJpZM4MNiCc.
Can you show me what your routes look like?
refix Verb URI Pattern Controller#Action root GET / program#index program_exercises GET /programs/:program_id/exercises(.:format) exercises#index POST /programs/:program_id/exercises(.:format) exercises#create new_program_exercise GET /programs/:program_id/exercises/new(.:format) exercises#new edit_program_exercise GET /programs/:program_id/exercises/:id/edit(.:format) exercises#edit program_exercise GET /programs/:program_id/exercises/:id(.:format) exercises#show PATCH /programs/:program_id/exercises/:id(.:format) exercises#update PUT /programs/:program_id/exercises/:id(.:format) exercises#update DELETE /programs/:program_id/exercises/:id(.:format) exercises#destroy programs GET /programs(.:format) programs#index POST /programs(.:format) programs#create new_program GET /programs/new(.:format) programs#new edit_program GET /programs/:id/edit(.:format) programs#edit program GET /programs/:id(.:format) programs#show PATCH /programs/:id(.:format) programs#update PUT /programs/:id(.:format) programs#update DELETE /programs/:id(.:format) programs#destroy
On Feb 27, 2017, at 2:47 PM, Nayana Davis notifications@github.com wrote:
Can you show me what your routes look like?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ga-wdi-exercises/project2/issues/819#issuecomment-282831265, or mute the thread https://github.com/notifications/unsubscribe-auth/AXqfmcWQuz1sYkjelg-TcbId_Vq2Jul9ks5rgyhSgaJpZM4MNiCc.
think you need something like
def edit
@program = Program.find(params[:program_id])
@exercise = Exercise.find(params[:id])
end
That did the trick!! Thank you!
On Feb 27, 2017, at 2:50 PM, Nayana Davis notifications@github.com wrote:
think you need something like
def edit @program = Program.find(params[:program_id]) @exercise = Exercise.find(params[:id]) end — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ga-wdi-exercises/project2/issues/819#issuecomment-282832071, or mute the thread https://github.com/notifications/unsubscribe-auth/AXqfmeVBcESXaWppU44RY2XVnygQ6lIEks5rgyjzgaJpZM4MNiCc.
👍
Hello,
I am trying to enable edit functionality for my child-model and I am getting the following error message:
NoMethodError in Exercises#edit Showing /Users/natashaclark/wdi/project/project2/fit2/app/views/exercises/edit.html.erb where line #3 raised:
undefined method `exercise_path' for #<#:0x007fe624a98550>
Extracted source (around line #3):
Edit Exercise
<%= form_for [@program, @exercise] do |f| %> <%= f.label :name %> <%= f.text_field :name %>
I thought I had my edit method set up correctly:
def edit @exercise = Exercise.find(params[:id]) end