Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove outdated cancan fix. #20

Merged
merged 1 commit into from
Jul 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ Given the need to support both Rails 3 and 4, the test suite has been parameteri
* Set Rails version you want to test against. For example:
* ```RAILS_VERSION=3.2.13``` or ```RAILS_VERSION=4.0.0```
* Ensure that the correct version of Rails is installed: ```bundle update```
* Build test app and run tests: ```bundle exec rake spec```
* Build test app: ```bundle exec engine_cart:generate```
* And run tests: ```bundle exec rake spec```
16 changes: 0 additions & 16 deletions lib/generators/roles/roles_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,6 @@ def inject_routes
inject_into_file 'config/routes.rb', "\n #{routing_code}\n", { :after => sentinel, :verbose => false }
end

# As of 7.23.2013 cancan support for Rails 4 is weak and requires monkey-patching.
# More information can be found at https://github.com/ryanb/cancan/issues/835
def rails4_application_controller_patch
if Rails::VERSION::MAJOR == 4
puts "Adding before_filter to application_controller to help Cancan work with Rails 4."
file_path = "app/controllers/application_controller.rb"
code = "\n before_filter do" +
"\n resource = controller_path.singularize.gsub('/', '_').to_sym\n" +
' method = "#{resource}_params"'+
"\n params[resource] &&= send(method) if respond_to?(method, true)" +
"\n end"

inject_into_file file_path, code, {after: 'class ApplicationController < ActionController::Base'}
end
end

# If this gem is installed under Rails 3, an attr_accessible method is required for the Role model. This
# file will be added to config/initializers and the correct code will be added to the model at runtime.
def rails3_attr_accessible
Expand Down