Sha256: 9bf6d7eefa08831c98f002ddf7e7b311638fa95388b191045d39765b5de1e72f

Contents?: true

Size: 414 Bytes

Versions: 7

Compression:

Stored size: 414 Bytes

Contents

class Widget < ActiveRecord::Base
  has_paper_trail
  has_one :wotsit
  has_many :whatchamajiggers, :as => :owner

  EXCLUDED_NAME = 'Biglet'

  validates :name, :exclusion => { :in => [EXCLUDED_NAME] }

  if ::ActiveRecord::VERSION::MAJOR >= 4 # `has_many` syntax for specifying order uses a lambda in Rails 4
    has_many :fluxors, lambda { order(:name) }
  else
    has_many :fluxors, :order => :name
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
paper_trail-4.2.0 test/dummy/app/models/widget.rb
paper_trail-4.1.0 test/dummy/app/models/widget.rb
paper_trail-4.0.2 test/dummy/app/models/widget.rb
paper_trail-4.0.1 test/dummy/app/models/widget.rb
paper_trail-4.0.0 test/dummy/app/models/widget.rb
paper_trail-4.0.0.rc2 test/dummy/app/models/widget.rb
paper_trail-4.0.0.rc1 test/dummy/app/models/widget.rb