mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-02-06 15:41:09 -05:00
13 lines
514 B
Ruby
13 lines
514 B
Ruby
class Seed < ActiveRecord::Base
|
|
attr_accessible :owner_id, :crop_id, :description, :quantity, :plant_before,
|
|
:tradable, :tradable_to
|
|
belongs_to :crop
|
|
belongs_to :owner, :class_name => 'Member', :foreign_key => 'owner_id'
|
|
|
|
TRADABLE_TO_VALUES = %w(locally nationally internationally)
|
|
validates :tradable_to, :inclusion => { :in => TRADABLE_TO_VALUES,
|
|
:message => "You may only trade seed locally, nationally, or internationally" },
|
|
:allow_nil => true,
|
|
:allow_blank => true
|
|
end
|