Skip to content

porting #668 to master branch #675

Merged
merged 1 commit into from May 3, 2013

5 participants

@xinuc
xinuc commented Jul 2, 2012

No description provided.

@xinuc xinuc referenced this pull request Jul 2, 2012
Merged

Fix namespace split #668

@ryanb
Owner
ryanb commented Jul 16, 2012

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
@andhapp
Collaborator
andhapp commented Jul 19, 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)
    resource.load_resource
    @controller.instance_variable_get(:@project).should == project
  end

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

@andhapp
Collaborator
andhapp commented Jul 19, 2012

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

@stas
stas commented Nov 28, 2012

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

Thanks.

@jrust
jrust commented Apr 24, 2013

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
Something went wrong with that request. Please try again.