Created
August 25, 2015 08:30
-
-
Save anonymous/73956f621e1c99070993 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I want to have a member_route on forms.rb that I can just send in 2 objects e.g. farmer_form_question_answers_admin_path(@farmer, @form) | |
So that on the rendered farmer_form_question_answers.html.arb I have both objects to work with to do: | |
@form.questions.answers.find_by(farmer_id: @farmer.id) | |
Here is my member route in admin/form.rb | |
member_action :farmer_form_question_answers do | |
@questions = resource[:form].questions | |
end | |
When I do farmer_form_question_answers_admin_path(farmer: @farmer.id, form: @form.id) I get an error: | |
Couldn't find Form with 'id'=1. However, actually my farmer.id = 1 and form.id = 3. | |
Here is how I am calling the route in my admin/farmer.rb | |
show do | |
panel "Participated Surveys" do | |
farmer_id = resource.id | |
table_for resource.forms do | |
column("Name") {|form| link_to(form.name, admin_form_path(form))} | |
column("Answers") { |form| link_to("answers", farmer_form_question_answers_admin_form_path(form: form, farmer: farmer_id))} | |
column :created_at | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment