Class: PettanrCreativeCommonsV30Licenses::Attribute
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- PettanrCreativeCommonsV30Licenses::Attribute
- Defined in:
- app/models/pettanr_creative_commons_v30_licenses/attribute.rb
Class Method Summary collapse
Instance Method Summary collapse
- #label_name(field_name = nil) ⇒ Object
- #resource_picture_attributes(op, ls) ⇒ Object
- #supply_default(operators) ⇒ Object
- #tag_name(field_name) ⇒ Object
Class Method Details
.remember_params(params, operators) ⇒ Object
35 36 37 38 39 40 |
# File 'app/models/pettanr_creative_commons_v30_licenses/attribute.rb', line 35 def self.remember_params params, operators op = OriginalPicture.show params[:original_picture_id], operators oplg = OriginalPictureLicenseGroup.new(params[:original_picture_license_group]) lg = LicenseGroup.show oplg.license_group_id, operators [op, oplg, lg] end |
Instance Method Details
#label_name(field_name = nil) ⇒ Object
42 43 44 |
# File 'app/models/pettanr_creative_commons_v30_licenses/attribute.rb', line 42 def label_name field_name = nil self.class.to_s + (field_name ? '.' + field_name : '') end |
#resource_picture_attributes(op, ls) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/models/pettanr_creative_commons_v30_licenses/attribute.rb', line 14 def resource_picture_attributes op, ls { :original_picture_id => op.id, :license_id => ls.id, :artist_name => self.artist_name, :system_picture_id => ls.system_picture_id, :license_group_classname => ls.license_group_classname, :license_group_settings => ls.license_group_settings, :credit_picture_settings => ls.credit_picture_settings, :license_settings => { :license_id => ls.id, # :system_picture_id => ls.system_picture_id, # no save :artist_name => self.artist_name, :caption => self., :artist_url => self.artist_url, :source_url => self.source_url, :more_permission_url => self. }.to_json } end |
#supply_default(operators) ⇒ Object
10 11 12 |
# File 'app/models/pettanr_creative_commons_v30_licenses/attribute.rb', line 10 def supply_default operators self.artist_name = operators.artist.name end |
#tag_name(field_name) ⇒ Object
46 47 48 |
# File 'app/models/pettanr_creative_commons_v30_licenses/attribute.rb', line 46 def tag_name field_name 'creative_commons_license[' + field_name + ']' end |