Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

spec & fix for params[:controller] in underscore format #681

Closed
wants to merge 2 commits into from
Closed

spec & fix for params[:controller] in underscore format #681

wants to merge 2 commits into from

Conversation

joxxoxo
Copy link

@joxxoxo joxxoxo commented Jul 5, 2012

code supposed that @params[:controller] is in camel case, but actually in rails it's in snake case

so i added .camelize in some methods

@joxxoxo
Copy link
Author

joxxoxo commented Apr 8, 2013

Exactly! But code in cancan

@params[:controller].split("::")[0..-2]

splits it by :: as if it was MyEngine::ProjectsController

looks like there's also unnecessary .gsub('Controller', '') in such case.
But I'm not sure if anyone needs this patch except me

@params.merge!(:controller => "my_engine/projects_controller", :action => "show", :id => project.id)
resource = CanCan::ControllerResource.new(@controller)
resource.load_resource
@controller.instance_variable_get(:@project).should == project

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, @ryanb prefers to use .should eq instead of .should ==

@joxxoxo
Copy link
Author

joxxoxo commented Apr 10, 2013

I've rebased against ryanb / cancan and changed == to eq :)

@xhoy
Copy link

xhoy commented Apr 10, 2014

Dear submitter, Since cancan/raynB hasn't been active for more than 6 months and no body else then ryam himself has commit permissions the cancan project is on a stand still.
Since cancan has several issues including missing support for rails 4 cancan is moving forward to cancancan. More details on: #994

If your feel that your pull request or bug is still applicable (and hasn't been merged in to cancan) it would be really appreciated if you would resubmit it to cancancan (https://github.com/cancancommunity/cancancan)

We hope to see you on the other side!

@joxxoxo joxxoxo closed this Feb 13, 2016
@joxxoxo
Copy link
Author

joxxoxo commented Feb 13, 2016

Closed, as it's fixed differently in cancancan

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants