Displaying 1 result from an estimated 1 matches for "5fthread".
Did you mean:
fthread
2009 Aug 17
1
Problem with setter override on ActiveRecord
...not help
when the author is not saved yet (it still has no id!) and I need the
objects be saved together (author must be saved only if book is
valid).
After search a lot for a solution (and try many other things in vain),
I found this message: http://groups.google.com/group/rubyonrails-talk/browse%5Fthread/thread/4fe057494c6e23e8,
so finally I could had some working code:
class Book < ActiveRecord::Base
belongs_to :author
def author_with_lookup=(author)
author = Author.find_or_initialize_by_name(author) if author.is_a?
String
self.author_without_lookup = author
end
alias_method_c...