Class: PettanrPublicDomainV01Licenses::AttributesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- PettanrPublicDomainV01Licenses::AttributesController
- Defined in:
- app/controllers/pettanr_public_domain_v01_licenses/attributes_controller.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.my_model ⇒ Object
12 13 14 |
# File 'app/controllers/pettanr_public_domain_v01_licenses/attributes_controller.rb', line 12 def self.my_model PettanrPublicDomainV01Licenses::Attribute end |
.my_module ⇒ Object
8 9 10 |
# File 'app/controllers/pettanr_public_domain_v01_licenses/attributes_controller.rb', line 8 def self.my_module PettanrPublicDomainV01Licenses end |
Instance Method Details
#create ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/pettanr_public_domain_v01_licenses/attributes_controller.rb', line 29 def create @original_picture, @original_picture_license_group, @license_group = self.class.my_model.remember_params params, @operators @attr = self.class.my_module.new_attribute params[:attributes] @license = ::License.show @attr.license_id, @operators @resource_picture = @original_picture.resource_picture || ResourcePicture.new @resource_picture.attributes = @attr.resource_picture_attributes @original_picture, @license @resource_picture.overwrite @original_picture respond_to do |format| if @attr.valid? format.html { render main_app.new_resource_picture_path } format.json { render json: @resource_picture.to_json(ResourcePicture.show_json_opt), status: :created } else format.html { render action: "new" } format.json { render json: @resource_picture.errors, status: :unprocessable_entity } end end end |
#new ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/pettanr_public_domain_v01_licenses/attributes_controller.rb', line 16 def new @original_picture, @original_picture_license_group, @license_group = self.class.my_model.remember_params params, @operators @attr = @license_group.my_engine.new_attribute {} # rare case ! # Attribute need artist name by @operators @attr.supply_default @operators respond_to do |format| format.html end end |