Method: ActiveAdmin::ResourceController::DataAccess#build_resource
- Defined in:
- lib/active_admin/resource_controller/data_access.rb
#build_resource ⇒ ActiveRecord::Base (protected)
Builds, memoize and authorize a new instance of the resource. The actual work of building the new instance is delegated to the #build_new_resource method.
This method is used to instantiate and authorize new resources in the new and create controller actions.
114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/active_admin/resource_controller/data_access.rb', line 114 def build_resource get_resource_ivar || begin resource = build_new_resource resource = apply_decorations(resource) resource = assign_attributes(resource, resource_params) run_build_callbacks resource resource set_resource_ivar resource end end |