Sha256: 9c39c4edda2d30efe87e05b6c32dca70c03cbd950609b53ca737527e3dba9b78
Contents?: true
Size: 1.07 KB
Versions: 49
Compression:
Stored size: 1.07 KB
Contents
module Para class ControllerResource < CanCan::ControllerResource # Todo : Document why this extension was added ? def assign_attributes(resource) if @options[:singleton] && parent_resource && resource.respond_to?(:"#{ parent_name }=") resource.send(:"#{ parent_name }=", parent_resource) end initial_attributes.each do |attr_name, value| resource.send(:"#{ attr_name }=", value) end resource end # Remove automatic params assignation and let our controllers do it # manually, letting our attribute fields to parse the params with a # reference to the current resource. # # Before this override, some attribute fields raised during #parse_input # because of the controller resource that was missing at the time it # was called (during the resource instanciation ...) # def build_resource resource = resource_base.new unless @options[:bypass_params_assignation] resource.assign_attributes(resource_params || {}) end assign_attributes(resource) end end end
Version data entries
49 entries across 49 versions & 1 rubygems