mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
Do not define column setter for absctract class
This commit is contained in:
parent
4427c353a3
commit
23f98a100d
1 changed files with 10 additions and 7 deletions
|
@ -54,6 +54,8 @@ module AASM
|
|||
# make sure to raise an error if no_direct_assignment is enabled
|
||||
# and attribute is directly assigned though
|
||||
aasm_name = @name
|
||||
if !(klass.superclass.methods.include?(:abstract_class) &&
|
||||
klass.superclass.abstract_class)
|
||||
klass.send :define_method, "#{@state_machine.config.column}=", ->(state_name) do
|
||||
if self.class.aasm(:"#{aasm_name}").state_machine.config.no_direct_assignment
|
||||
raise AASM::NoDirectAssignmentError.new(
|
||||
|
@ -64,6 +66,7 @@ module AASM
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# This method is both a getter and a setter
|
||||
def attribute_name(column_name=nil)
|
||||
|
|
Loading…
Reference in a new issue