17 lines
494 B
Ruby
17 lines
494 B
Ruby
class Portfolio < ActiveRecord::Base
|
|
attr_accessible :content_type, :description, :enabled, :haml_content, :html_content, :keywords, :markdown_content, :title, :slug
|
|
|
|
|
|
validates :title, :presence => true
|
|
validates :slug, :presence => true, :uniqueness => true
|
|
|
|
has_many :images, :through => :portfolio_portfolio_images, :source => :portfolio_image, :order => "shoot_at DESC"
|
|
has_many :portfolio_portfolio_images
|
|
|
|
def path
|
|
"/portfolios/#{self.slug}.html"
|
|
end
|
|
|
|
|
|
end
|