has_many :resource_pictures
validates :license_group_id, :presence => true, :numericality => true, :existence => {:both => false}
- validates :license_group_classname, :presence => true, :length => {:maximum => 50}
+ validates :license_group_module_name, :presence => true, :length => {:maximum => 50}
validates :name, :presence => true, :length => {:maximum => 50}
validates :caption, :presence => true, :length => {:maximum => 30}
validates :url, :presence => true, :length => {:maximum => 200}, :uniqueness => {:scope => :name}, :url => {:message => I18n.t('errors.messages.url')} #{:allow_blank => true}
validates :system_picture_id, :presence => true, :numericality => true, :existence => {:both => false}
+ validates :license_group_settings, :boost => {:boost_name => :license_group}
+ validates :credit_picture_settings, :boost => {:boost_name => :credit_picture}
- def supply_default
- end
-
- def overwrite
+ def overwrite
end
def caption_with_group
self.license_group.caption + '/' + self.caption
end
- def self.list_where
+ def self.index_list_where list
''
end
- def self.list_order
- 'licenses.name'
- end
-
- def self.list_opt
- {:license_group => {}}
- end
-
- def self.list_json_opt
- {:include => {:license_group => {}}}
- end
-
def self.show_opt
{:include => {:license_group => {}}}
end
- def self.show_json_opt
- {:include => {:license_group => {}}}
- end
-
def self.list_by_name name
License.find :all, :conditions => ['licenses.name = ?', name], :order => 'licenses.updated_at desc'
end
attr['credit_picture_settings'] = attr['credit_picture_settings'].to_json
attr['license_group_settings'] = attr['license_group_settings'].to_json
l = License.modify_object name, attr
+ l.boosts 'post'
if r == false
l.errors.add :base, SystemPicture.model_name.human + I18n.t('errors.not_create')
else
res
end
- def credit_pictures_attr
- return @credit_pictures_attr if @credit_pictures_attr
- begin
- @credit_pictures_attr = JSON.parse(self.credit_pictures)
- rescue
- end
- @credit_pictures_attr = {} unless @credit_pictures_attr
- @credit_pictures_attr
- end
-
def self.export(dt = nil)
opt = {}
opt.merge!({:conditions => ['updated_at >= ?', dt]}) if dt