module InheritedResources::SingletonHelpers
def collection
Singleton methods does not deal with collections.
def collection nil end
def method_for_association_build #:nodoc:
Returns the appropriated method to build the resource.
def method_for_association_build #:nodoc: :"build_#{resource_instance_name}" end
def method_for_association_chain #:nodoc:
above for more information.
Sets the method_for_association_chain to nil. See resource
def method_for_association_chain #:nodoc: nil end
def resource
So we have to call manager on it, not find.
Project.find(params[:project_id])
The association chain will be:
end
belongs_to :project, :singleton => true
class ManagersController < InheritedResources::Base
In singleton controllers:
chain. And this is what happened.
So you would just have to call find(:all) at the end of association
Project.find(params[:project_id]).tasks
In this case, the association chain would be:
end
belongs_to :project
class TasksController < InheritedResources::Base
end_of_association_chain here is not the same as in default belongs_to.
If you are going to overwrite it, you should notice that the
Overwrites how singleton deals with resource.
def resource get_resource_ivar || set_resource_ivar(end_of_association_chain.send(resource_instance_name)) end