I have a a scenario where I had to use belongs_to association in a Parent Controller as well as Child Controller. In this scenario, the helpers like collection_url are generating wrong and I get undefined method....
Below is my scenario..
class ProjectController < InheritedResources::Base
class JavaProjectController < ProjectController
class TaskController < InheritedResources::Base
belongs_to :project
end
class JavaTaskController < TaskController
belongs_to :java_project
end
In this above scenario, when I tried to generate <%= collection_url %>
inside my view under JavaTaskController
, I get the following error :
NoMethodError ... java_project_java_project_java_tasks_url
If the collection_url
is called in the context of TaskController
, everything works fine.
However, if I comment out the belongs_to
association in the TaskController
, now the collection_url
works fine when running in the context of JavaTaskController
.
What am I missing? Is this a bug or limitation? Or Am I doing something silly?
Any help in this regard would be very much appreciated.