Skip to content

Instantly share code, notes, and snippets.

@lime
Created July 2, 2013 11:11
Show Gist options
  • Save lime/5908474 to your computer and use it in GitHub Desktop.
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
before_filter do
resource = controller_path.singularize.gsub('/', '_').to_sym
method = "#{resource}_params"
params[resource] &&= send(method) if respond_to?(method, true)
end
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