Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Card < ActiveRecord::Base
- translates :title, :description
- belongs_to :card_image, :include => true, :autosave => true, :dependent => :destroy, :validate => true
- belongs_to :card_type, :include => true
- belongs_to :card_rarity, :include => true
- serialize :script
- validates_presence_of :alias
- validates_uniqueness_of :alias, :case_sensitive => false
- validates_format_of :alias, :with => /[a-z_][a-z0-9_-]*/i
- validates_presence_of :title
- validates_uniqueness_of :title
- validates_associated :card_image
- validates_presence_of :description
- validates_presence_of :price
- validates_numericality_of :price, :only_integer => true, :greater_than_or_equal_to => 0
- validates_presence_of :cost
- validates_numericality_of :cost, :only_integer => true, :greater_than_or_equal_to => 0
- validates_presence_of :move
- validates_numericality_of :move, :only_integer => true, :greater_than_or_equal_to => 0
- validates_associated :card_type
- validates_associated :card_rarity
- def enabled?(type)
- card_type.script[:disable] != type && script[:disable] != type
- end
- end
Add Comment
Please, Sign In to add comment