You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
object @submission
attributes :status, :submission_time
child :report do
attribute :id, :name
child :questions do
attribute :id, :content
node(:answers_count) do |question|
question.answers.where("submission_id = ?", @submission.id).count
end
node(:answers) do |question|
question.answers.where("submission_id = ?", @submission.id).collect{ |answer| {:name => answer.name, :id => answer.id}}
end
end
end
This is working perfectly fine but the problem is in answers_count and answers node I am using @submission and because of that index action is not working.
Its fine in show action but index action is creating issues as @submission is not available in index action.
PS: Once I fix the issue I will move the big query from view to model. I know that, Just for simplicity I have pasted that inline.
I have a Submission model
Report Model
Question Model
Now in rabl template I need output like this
This is working perfectly fine but the problem is in answers_count and answers node I am using @submission and because of that index action is not working.
Its fine in show action but index action is creating issues as @submission is not available in index action.
PS: Once I fix the issue I will move the big query from view to model. I know that, Just for simplicity I have pasted that inline.
More details can be found here on stackoverflow
The text was updated successfully, but these errors were encountered: