cirandas.net

ref: master

plugins/products/models/products_plugin/unit.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
class ProductsPlugin::Unit < ApplicationRecord

  self.table_name = :units

  acts_as_list scope: -> unit { where environment_id: unit.environment_id }

  attr_accessible :name, :singular, :plural, :environment

  belongs_to :environment

  validates_presence_of :environment_id
  validates_presence_of :singular
  validates_presence_of :plural

  def name
    self.singular
  end
  def name=(value)
    self.singular = value
  end

end