Sha256: 73231de71720e2e22fc165951f81479e9b63c5bbd2b4a48a7d47a6c36bb26951

Contents?: true

Size: 597 Bytes

Versions: 4

Compression:

Stored size: 597 Bytes

Contents

module Spree
  class Question < ActiveRecord::Base
    has_and_belongs_to_many :taxons, :join_table => 'spree_questions_taxons'
    has_and_belongs_to_many :products, :join_table => 'spree_products_questions'
    
    attr_accessible :question, :answer, :description
    
    paginates_per 10

    validates :question, :presence => true, :uniqueness => true
    validates :slug, :uniqueness => true
    validates_presence_of :answer

    before_validation do
      self.slug = question.to_s.to_url(:limit => 64) unless slug
    end
    
    def to_param
      slug
    end
      
      
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spree_grid_faq-0.1.0 app/models/spree/question.rb
spree_grid_faq-0.0.9 app/models/spree/question.rb
spree_grid_faq-0.0.8 app/models/spree/question.rb
spree_grid_faq-0.0.7 app/models/spree/question.rb