Class: PettanrUnknownV01Licenses::Attribute
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- PettanrUnknownV01Licenses::Attribute
- Defined in:
- app/models/pettanr_unknown_v01_licenses/attribute.rb
Class Method Summary collapse
Instance Method Summary collapse
- #engine_name ⇒ Object
- #form_name ⇒ Object
- #label_name(field_name = nil) ⇒ Object
- #resource_picture_attributes(op, ls) ⇒ Object
-
#supply_default(operators) ⇒ Object
validates :source_url, :presence => true validates :note, :presence => true.
- #tag_name(field_name) ⇒ Object
- #trans_name(field_name = nil) ⇒ Object
Class Method Details
.remember_params(params, operators) ⇒ Object
32 33 34 35 36 37 |
# File 'app/models/pettanr_unknown_v01_licenses/attribute.rb', line 32 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
#engine_name ⇒ Object
39 40 41 |
# File 'app/models/pettanr_unknown_v01_licenses/attribute.rb', line 39 def engine_name "pettanr_unknown_v01_licenses" end |
#form_name ⇒ Object
43 44 45 |
# File 'app/models/pettanr_unknown_v01_licenses/attribute.rb', line 43 def form_name self.engine_name + '/attributes' end |
#label_name(field_name = nil) ⇒ Object
47 48 49 |
# File 'app/models/pettanr_unknown_v01_licenses/attribute.rb', line 47 def label_name field_name = nil self.class.to_s + (field_name ? '.' + field_name : '') end |
#resource_picture_attributes(op, ls) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/models/pettanr_unknown_v01_licenses/attribute.rb', line 13 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, :source_url => self.source_url, :note => self.note }.to_json } end |
#supply_default(operators) ⇒ Object
validates :source_url, :presence => true validates :note, :presence => true
9 10 11 |
# File 'app/models/pettanr_unknown_v01_licenses/attribute.rb', line 9 def supply_default operators self.artist_name = operators.artist.name end |
#tag_name(field_name) ⇒ Object
55 56 57 |
# File 'app/models/pettanr_unknown_v01_licenses/attribute.rb', line 55 def tag_name field_name 'attributes[' + field_name + ']' end |
#trans_name(field_name = nil) ⇒ Object
51 52 53 |
# File 'app/models/pettanr_unknown_v01_licenses/attribute.rb', line 51 def trans_name field_name = nil self.engine_name + '.' + field_name end |