Created
July 2, 2013 11:11
-
-
Save lime/5908474 to your computer and use it in GitHub Desktop.
A workaround for using cancan with strong_parameters, as suggested by AntonTrapp and JiriKolarik in this issue: https://github.com/ryanb/cancan/issues/835#issuecomment-20229737
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before_filter do | |
resource = controller_path.singularize.gsub('/', '_').to_sym | |
method = "#{resource}_params" | |
params[resource] &&= send(method) if respond_to?(method, true) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def note_params | |
params.require(:note).permit(:what, :ever) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment