I'm seeing a strange issue with the following code. I've also included
the relevant log entries. Note that 'released_on' is set in the SELECT
query but is NULL in the INSERT query. What gives?
year = hash["release_date"] || hash["year"]
album = Album.find_or_create_by_title_and_released_on :title =>
hash["album"], :number_of_tracks => hash["track_count"], :released_on
=> year
Album Load (0.2ms) SELECT `albums`.* FROM `albums` WHERE
(`albums`.`released_on` = '1978') AND (`albums`.`title` = 'Drum
Outtakes') LIMIT 1
AREL (2.1ms) INSERT INTO `albums` (`created_at`, `released_on`,
`updated_at`, `title`, `number_of_tracks`) VALUES ('2011-01-03
22:43:27', NULL, '2011-01-03 22:43:27', 'Drum Outtakes', 23)
M
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment