Sha256: 9b9c2e14def0205c643e297b4c7550c63cc776768e2aeb7b852258453c71ecf4

Contents?: true

Size: 663 Bytes

Versions: 1

Compression:

Stored size: 663 Bytes

Contents

# this is needed for now to make mass assignment security compatible with the translation of globalize3
Globalize::ActiveRecord::Translation.class_eval do
  attr_accessible :locale
end

class Page < ActiveRecord::Base
  
  belongs_to :author, class_name: 'User', foreign_key: 'author_id'
  
  attr_accessible :body, :description, :title, :blog_post, :for_blog
  
  validates_presence_of :title
  validates_presence_of :description
  validates_presence_of :body
  validates_presence_of :author_id
  
  translates :title, :description, :body
    
  def to_param
    title ? "#{id}-#{title.to_url}" : id
  end

  scope :by_recent, :order => 'updated_at desc'
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tkh_content-0.1 app/models/page.rb