Reputation: 2685
I am trying to make an app with Rails 4 and simple form.
I have three models - Project, Project_Question and Project_Answer. I made all of these by generating scaffolds so all naming conventions have been followed.
My resources are nested:
resources :projects do
resources :project_questions do
resources :project_answers
end
end
I am trying to use the console to find project answers created in my testing, but when I try to search for project answers:
2.1.1p76 :001 > Project_Answer.where(:answer => [hgvbhjb]).first
I get this error message:
LoadError: Unable to autoload constant Project_Answer, expected /app/models/project_answer.rb to define it.
The other problems on this site that seem to get the same error messages appear to be where people have not named their model.rb files in the singular. I have that.
I can only think that there is an extra step required to search the console if resources are nested. Does this sound plausible? If so, are there any materials to help figure out how to search the console with nested resources?
Can anyone see what has gone wrong?
Upvotes: 0
Views: 144
Reputation: 33542
You are doing it wrong. It should be
ProjectAnswer.where(:answer => "hgvbhjb").first
Upvotes: 1