Sha256: ecb9dbeb1dac26a8514e35a505c8597a99b1226cf9262bd63465c47c86c80488
Contents?: true
Size: 714 Bytes
Versions: 4
Compression:
Stored size: 714 Bytes
Contents
class Post < ActiveRecord::Base include Carnival::ModelHelper has_attached_file :cover, :default_url => "missing.png" belongs_to :user has_many :comments has_many :post_files has_and_belongs_to_many :tags validates :cover, :title, presence: true validates_attachment :cover, content_type: { content_type: ["image/jpg", "image/jpeg", "image/png", "image/gif"] } scope :to_tags, -> (tag_id){joins(:tags).where('tags.id' => tag_id)} accepts_nested_attributes_for :post_files, allow_destroy: true, reject_if: proc { |attributes| attributes['title'].blank? } accepts_nested_attributes_for :tags ACTIVE = 1 INACTIVE = 2 STATUS = {ACTIVE => "Active", INACTIVE => "Inactive" } end
Version data entries
4 entries across 4 versions & 1 rubygems