fixing instance loading with :singleton option - closes #310
This commit is contained in:
parent
3efa069349
commit
7688025404
|
@ -113,7 +113,7 @@ module CanCan
|
|||
end
|
||||
|
||||
def member_action?
|
||||
new_actions.include?(@params[:action].to_sym) || (@params[:id] && !collection_actions.include?(@params[:action].to_sym))
|
||||
new_actions.include?(@params[:action].to_sym) || @options[:singleton] || (@params[:id] && !collection_actions.include?(@params[:action].to_sym))
|
||||
end
|
||||
|
||||
# Returns the class used for this resource. This can be overriden by the :class option.
|
||||
|
|
|
@ -258,8 +258,8 @@ describe CanCan::ControllerResource do
|
|||
@controller.instance_variable_get(:@project).should == :some_project
|
||||
end
|
||||
|
||||
it "should find record through has_one association with :singleton option" do
|
||||
@params.merge!(:action => "show", :id => 123)
|
||||
it "should find record through has_one association with :singleton option without id param" do
|
||||
@params.merge!(:action => "show", :id => nil)
|
||||
category = Object.new
|
||||
@controller.instance_variable_set(:@category, category)
|
||||
stub(category).project { :some_project }
|
||||
|
|
Loading…
Reference in New Issue
Block a user