On Aug 17, 9:31 pm, Fearless Fool <li...@ruby-forum.com> wrote:
> Frederick Cheung wrote:
> > You've got it out of find_by_sql so rails thinks its an existing row.
> > Furthermore rails doesn't think the object has changed since you
> > retrieved it from the database, so it shortcircuits the save (since
> > from its point of view there is nothing to save)
>
> > Fred
>
> Fred:
>
> Your explanation makes sense.  If this is not a bug in ActiveRecord,
> then there IS a bug in the documentation -- it has to be one or the
> other.  This is new territory for me: is there a writeup on how to
> properly report a documentation bug?
>
I'm not sure that's true - you're doing something that is really
rather strange.
I'd get in touch with the docrails folks - ask around in #rails-
contrib

> A second (and lesser) question: is there a way to force a save?  That
> would save me creating and copying a new one.
>

in this particular case you don't just need to mark the record as
dirty, you need to mark the record as being a new record. As far as I
know the only way to do that is to set the new_record instance
variable. Personally I'd take the need to muddle with AR internals as
a hint not to do this.

Fred


-- 
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-t...@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.

Reply via email to