Files
growstuff/app/models/crop.rb
Skud 5f13567dd1 Added stringification for crops
to prevent plantings from having to know too much about the crop model
2012-12-19 21:31:17 +11:00

16 lines
308 B
Ruby

class Crop < ActiveRecord::Base
extend FriendlyId
friendly_id :system_name, use: :slugged
attr_accessible :en_wikipedia_url, :system_name
has_many :scientific_names
def Crop.random
@crop = Crop.offset(rand(Crop.count)).first
return @crop
end
def to_s
return system_name
end
end