On 4 January 2011 16:47, Michael Irwin <mike@manicdev.com> wrote:
> released_on is of column type DATE.
Please don't top post, insert your comment into the previous email.
It makes it easier to follow the thread. Thanks
Looking at your post it seems that you are passing '1978'. You may
know that that is a date but I wonder whether rails does. It might be
worth trying passing a Date in to find_or_create_by.
Colin
>
> On Jan 4, 5:52 am, Colin Law <clan...@googlemail.com> wrote:
>> On 3 January 2011 23:49, Michael Irwin <m...@manicdev.com> wrote:
>>
>>
>>
>>
>>
>> > 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)
>>
>> What column type is released_on?
>>
>> Colin
>
> --
> 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.
>
>
--
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