To add, I am seeing the following when I retrieve an existing Root
object in the Rails console and then try to save it again:

=> #<Root id: 1, type: "Root", name: "Base of Administrator",
yaml_container: nil, parent_id: nil, owner_id: 1, custodian_id: 1,
property_control_id: 1, include_parent_responses: false, inheritable:
false, response_vehicle_id: nil, acquire_child_values: false,
description: nil, rating: nil, link_base_id: nil, base_image_id: nil,
event_when_id: nil, event_description_id: nil>
>> root.save
NoMethodError: undefined method `each' for true:TrueClass
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
base.rb:2808:in `attributes_with_quotes'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
base.rb:2706:in `update_without_lock'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
locking/optimistic.rb:70:in `update_without_dirty'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
dirty.rb:146:in `update_without_callbacks'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
callbacks.rb:253:in `update_without_timestamps'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
timestamp.rb:38:in `update'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
base.rb:2699:in `create_or_update_without_callbacks'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
callbacks.rb:222:in `create_or_update'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
base.rb:2383:in `save_without_validation'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
validations.rb:1009:in `save_without_dirty'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
dirty.rb:79:in `save_without_transactions'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
transactions.rb:179:in `send'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
transactions.rb:179:in `with_transaction_returning_status'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/abstract/database_statements.rb:66:in
`transaction'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
transactions.rb:129:in `transaction'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
transactions.rb:138:in `transaction'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
transactions.rb:178:in `with_transaction_returning_status'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
transactions.rb:146:in `save'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
transactions.rb:158:in `rollback_active_record_state!'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
transactions.rb:146:in `save'

Any thoughts much appreciated.

On 20 Dec, 06:54, "[email protected]"
<[email protected]> wrote:
> I have been working through an upgrade of my 1.2.6 application to
> 2.2.2.
>
> I am almost there but I have hit a problem with ActiveRecord.
>
> Before the upgrade, the following code was working fine.
>
>     def create_root(administrator)
>         root = create_root_collection(self.pingee_name,
>                                       administrator,
>                                       GlobalAccessibility.new,
>                                       OwnerAccessibility.new)
>         root.save
>         self.root = root
>     end
>
> But now I get am getting an exception "undefined method `each' for
> true:TrueClass" when root.save is executed.
>
> fyi, the "create_root_collection" method creates a "root" object and
> assigns new object to its "belongs to" association.
>
> I have traced it through carefully and it is definitely failing when
> trying to save the "root" object itself.
>
> Given the error message, and the fact that the root object contains
> boolean columns, I wonder if the problem is to do with the saving
> boolean values. I am using MySQL and declaring the boolean columns in
> the following way (using raw SQL not migrations currently):
>
> include_parent_responses boolean default false not null,
>
> Is the "boolean" column type still valid?
>
> Thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to