Files
growstuff/app/models/scientific_name.rb
2018-01-03 17:16:14 +13:00

8 lines
296 B
Ruby

class ScientificName < ApplicationRecord
after_commit { |sn| sn.crop.__elasticsearch__.index_document if sn.crop && ENV['GROWSTUFF_ELASTICSEARCH'] == "true" }
belongs_to :crop
belongs_to :creator, class_name: 'Member'
validates :name, presence: true
validates :crop, presence: true
end