search for: pub_year

Displaying 1 result from an estimated 1 matches for "pub_year".

Did you mean: dob_year
2009 Aug 17
1
Problem with setter override on ActiveRecord
...author = Author.find_or_initialize_by_name(author) if author.is_a? String self.write_attribute(:author, author) end end Unfortunately, this does not work. That''s what I get from console: >> book = Book.new(:name => "Alice''s Adventures in Wonderland", :pub_year => 1865) => #<Book id: nil, name: "Alice''s Adventures in Wonderland", pub_year: 1865, author_id: nil, created_at: nil, updated_at: nil> >> book.author = "Lewis Carroll" => "Lewis Carroll" >> book => #<Book id: nil, name: "...