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

8 lines
295 B
Ruby

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