Sha256: d0f3cf4b74491472b3fb4f7298c41e8ffcc7c830ffcaf135bc9aeb12ceeba126

Contents?: true

Size: 407 Bytes

Versions: 10

Compression:

Stored size: 407 Bytes

Contents

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

  EXCLUDED_NAME = "Biglet".freeze

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

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

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/paper_trail-5.2.3/test/dummy/app/models/widget.rb
paper_trail-6.0.0 test/dummy/app/models/widget.rb
paper_trail-5.2.3 test/dummy/app/models/widget.rb
paper_trail-5.2.2 test/dummy/app/models/widget.rb
paper_trail-5.2.1 test/dummy/app/models/widget.rb
paper_trail-5.2.0 test/dummy/app/models/widget.rb
paper_trail-5.1.1 test/dummy/app/models/widget.rb
paper_trail-5.1.0 test/dummy/app/models/widget.rb
paper_trail-5.0.1 test/dummy/app/models/widget.rb
paper_trail-5.0.0 test/dummy/app/models/widget.rb