Exception: ActiveRecord::Associations::NotPortableError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/portable_model/active_record.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(assoc) ⇒ NotPortableError

Returns a new instance of NotPortableError.



8
9
10
# File 'lib/portable_model/active_record.rb', line 8

def initialize(assoc)
  super("#{assoc.proxy_reflection.name}:#{assoc.proxy_reflection.klass.name} is not portable")
end

Class Method Details

.raise_on_not_portable(assoc) ⇒ Object

Raises:



14
15
16
# File 'lib/portable_model/active_record.rb', line 14

def raise_on_not_portable(assoc)
  raise NotPortableError.new(assoc) unless assoc.proxy_reflection.klass.include?(PortableModel)
end