Typically, when one creates a has_many associated table one does this:
hasone.hasmany.build({attribute hash},{attribute hash},..} or
hasone.hasmany.create({attribute hash}, ...
However, if mass assignment is turned off (attr_accessible => nil), then
I cannot seem to set the attributes directly.
For example, in a console session I do this:
>> me = Entity.new
=> ...
>> me.attribute = ...
...
>> me.save!
=> true
>> mi = me.identifiers.build
=> ...
>> mi.entity_id
=> 1
>> mi.identifier_type = 'post'
=> 'post'
>> mi.identifier_type
=> nil
What is going on and how do I directly set association attributes?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---