Skip to content

Commit

Permalink
Merge branch 'support_strong_parameters'
Browse files Browse the repository at this point in the history
  • Loading branch information
madmax committed Feb 24, 2014
2 parents aebd42e + 48f6946 commit 5984ff5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/cancan/controller_resource.rb
Expand Up @@ -216,14 +216,24 @@ def name
def resource_params
if @options[:class]
params_key = extract_key(@options[:class])
return @params[params_key] if @params[params_key]
if params = fetch_params(params_key)
return params
end
end

resource_params_by_namespaced_name
end

def resource_params_by_namespaced_name
@params[extract_key(namespaced_name)]
fetch_params extract_key(namespaced_name)
end

def fetch_params(key)
@controller.respond_to?(params_method(key), true) ? @controller.send(params_method(key)) : @params[key]
end

def params_method(key)
"#{key}_params".to_sym
end

def namespace
Expand Down

0 comments on commit 5984ff5

Please sign in to comment.