On Oct 19, 10:08 am, Max Williams <rails-mailing-l...@andreas-s.net>
wrote:
> I just noticed this odd behaviour (in rails 2.2.2). It looks like
> changing the type with update_attributes *doesn't* work (but returns
> true!), but changing the field and then saving it *does* work. Here i
> have an STI situation where TeachingObject and LearningObject extend
> Resource.
>
> The bit where update_attributes returns true, yet seems to fail, is
> rather disconcerting. Can anyone explain what's going on here?
I believe that the type column is marked as a protected attribute or
something along those lines.
Fred
>
> thanks -max
>
> >> resource = Resource.first
>
> => #<TeachingObject id: 59, name: "Clarinet bite point close-up",
> description: "", type: "TeachingObject", <etc> >>>
> resource.update_attributes(:type => "LearningObject")
> => true
> >> resource = Resource.first
>
> => #<TeachingObject id: 59, name: "Clarinet bite point close-up",
> description: "", type: "TeachingObject", <etc> >>> resource.type =
> "LearningObject"
> => "LearningObject"
> >> resource.save
> => true
> >> resource = Resource.first
>
> => #<LearningObject id: 59, name: "Clarinet bite point close-up",
> description: "", type: "LearningObject", <etc> >
> --
> Posted viahttp://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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---