Sha256: cf03341c41630cec123d79824101d2d6027b88183e4f2915e9a57c1b0d6a2990

Contents?: true

Size: 751 Bytes

Versions: 1

Compression:

Stored size: 751 Bytes

Contents

class Article < ActiveRecord::Base
  attr_accessible :body, :title, :category, :tag_ids, :images, :downloads

  # Translations
  translates :title, :body

  # Markdown
  markdown :body

  # Assets
  has_many_assets :images, :images
  has_many_assets :downloads, :downloads

  # Validations
  validates :title, presence: true

  # Markdown columns
  markdown :body, tables: true, link_schemes: {
    "youtube" => Lalala::Markdown::Handlers::YouTube.new(width: 520, height: 292),
    "asset" => Lalala::Markdown::Handlers::Asset.new
  }

  # Scopes
  scope :catA, where(:category => "A")
  scope :catB, where(:category => "B")
  scope :catC, where(:category => "C")

  # Bindings
  has_and_belongs_to_many :tags

  def get_tags
    self.tags
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lalala-4.1.0.dev.299 test/dummy/app/models/article.rb