porting #668 to master branch #675

merged 1 commit into from May 3, 2013

5 participants


No description provided.

@xinuc xinuc referenced this pull request Jul 2, 2012

Fix namespace split #668


This doesn't make as much sense with the CanCan 1.x behavior since that Ability is intended to be focused on models and not controllers. With CanCan 2.0 using the controller name and mapping that to the model it makes sense in that release only.

@ryanb ryanb closed this Jul 16, 2012

@ryanb: I think the spec is incorrectly written and I'm sure it'll make more sense if it's like this:

it "should properly load resource for namespaced controller" do
    project = Project.create!
    @params.merge!(:controller => "admin/projects", :action => "show", :id => project.id)
    resource = CanCan::ControllerResource.new(@controller)
    @controller.instance_variable_get(:@project).should == project

But a similar spec is in the project already and now I am totally confused about this issue. Anyways, ignore this comment.


@ryanb: This fix is related to this issue #663.


Hey guys, I would like to reopen this PR. It is relevant to me when working with a Rails engine.



Agreed with @stas. @params[:controller] in an engine is engine_name/controller_name because it wraps the whole engine up in a routing scope.

@ryanb ryanb reopened this May 3, 2013
@ryanb ryanb merged commit 60cf6a6 into ryanb:master May 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment