Sha256: 8dab50ed56342b588fcb6cbc6accbaa4fffdabdb3eef01beb9c5e116ba0097ca

Contents?: true

Size: 665 Bytes

Versions: 4

Compression:

Stored size: 665 Bytes

Contents

require 'carrierwave'
require 'carrierwave/orm/activerecord'
module Adminpanel
	class Section < ActiveRecord::Base
	  attr_accessible :description, :file, :has_image, :key, :name, :has_description, :images_attributes
	  has_many :images, :foreign_key => "foreign_key", :conditions => { :model => "Section" }
	  accepts_nested_attributes_for :images, :allow_destroy => true
	  mount_uploader :file, Adminpanel::SectionUploader
	  validates_length_of :description, :minimum => 10, :on => :update, :if => lambda{|section| section.key == "telephone"}
	  validates_presence_of :description, :on => :update

	  def simple_name
	  	"Section"
	  end
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
adminpanel-0.0.4 app/models/adminpanel/section.rb
adminpanel-0.0.3 app/models/adminpanel/section.rb
adminpanel-0.0.2 app/models/adminpanel/section.rb
adminpanel-0.0.1 app/models/adminpanel/section.rb