Sha256: fc4a732a04f07501fe8a025c51a2906f9be39baf14d48931323e4d535e01d335
Contents?: true
Size: 1.12 KB
Versions: 3
Compression:
Stored size: 1.12 KB
Contents
require 'carrierwave' require 'carrierwave/orm/activerecord' module Adminpanel class Section < ActiveRecord::Base attr_accessible :description, :has_image, :key, :page, :name, :has_description, :images_attributes, :file mount_images :images validates_length_of :description, :minimum => 10, :maximum => 10, :on => :update, :if => lambda{|section| section.key == I18n.t('key.telephone')} validates_presence_of :description, :minimum => 9, :on => :update, :if => lambda{|section| section.has_description == true} validates :description, :numericality => { :only_integer => true }, :on => :update, :if => lambda{|section| section.key == I18n.t('key.telephone')} validates_presence_of :key validates_presence_of :name validates_presence_of :page default_scope { order("page ASC")} scope :of_page, lambda{|page| where(:page => page)} def self.form_methods [ {'description' => {'name' => 'Descripcion'}}, {'name' => {'name' => 'name'}}, {'key' => {'name' => 'key'}}, {'page' => {'name' => 'page'}}, # {'key' => {'name' => 'key'}}, ] end def simple_name "Section" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
adminpanel-1.2.8 | app/models/adminpanel/section.rb |
adminpanel-1.2.7 | app/models/adminpanel/section.rb |
adminpanel-1.2.6 | app/models/adminpanel/section.rb |