This project is archived and is in readonly mode.
v 2.3.2 - appropriates attributes ending in _type and _value
-
James B. Byrne
Lost example added:
Using write_attribute skips attribute= processing in model.
>> mn.write_attribute(code_type, "MixCase") NameError: undefined local variable or method `code_type' for #<Object:0x2b1bc50203f8> from (irb):19 >> mn.write_attribute("code_type", "MixCase") => "MixCase" >> mn => #<Identifier id: nil, entity_id: 1, code_type: "MixCase", code_value: nil> >> -
James B. Byrne
- Title changed from v 2.3.2 - appropriates attributed ending in _type and _value to v 2.3.2 - appropriates attributes ending in _type and _value
-
James B. Byrne
mi = me.identifiers.build => mi.code_type = "Xray" => "Xray" mi.code_type => nil mn = Identifier.new => mn.entity_id = 1 => 1 mn.code_type = "Whisky" => "Whisky" mn,code_type => nil
-
James B. Byrne
This appears to be dependent upon whether or not the model name forms part of the attribute name. So:
mi = Identity.new => ... mi.x_type = "A Type" => "A Type" mi.x_type => "A Type" mi.identifier_type = "this type" => "this type" mi.identifier_type => nil
-
James B. Byrne
- Tag changed from 2.3.2, activerecord, attributes, defect to invalid
Please close. Invalid.
-
Matt Jones
What was the final resolution? Before closing the ticket, it's good to know what happened, in case others run into the same problem.
-
James B. Byrne
Sorry for the late replay, I did not get an email notice when the ticket was updated, or missed it if I did.
The error was mine. I had the attr_protected set for those fields in the model that I was testing.
-
Frederick Cheung
- State changed from new to invalid