On 17 July 2011 05:04, Ahmy Yulrizka <[email protected]> wrote:

Please don't top post, it makes it difficult to follow the thread.
Insert your reply at appropriate points in the previous message.
Thanks.

> Here i've manage to debug the script running cucumber.
> def create
>     @photo = Photo.new(params[:photo])
>
>     @photo.status = 'Uncategorized' if !user_signed_in?
>
>     @photo.md5sum = @photo.file.fingerprint
>     @duplicate = Photo.find_by_md5sum(@photo.md5sum)
>
>     => debugger
> ...
> ruby-1.9.2-p180 :012 > @photo
>  => #<Photo id: nil, owner_id: "owner_id 2", status: "Uncategorized", note:
> "note 2", created_at: nil, updated_at: nil, file_file_name: "rails.png",
> file_content_type: "image/png", file_file_size: 79406, file_updated_at:
> "2011-07-17 03:51:34", md5sum: "4f9c652dfa2b307ce11efe85afcef98b", width:
> 300, height: 356>
>
> ruby-1.9.2-p180 :011 > Photo.all
>  => [#<Photo id: 1, owner_id: "owner_id 1", status: "Uncategorized", note:
> "note 1", created_at: "2011-07-17 03:51:33", updated_at: "2011-07-17
> 03:51:33", file_file_name: "rails.png", file_content_type: "image/png",
> file_file_size: 79406, file_updated_at: "2011-07-17 03:43:56", md5sum:
> "4f9c652dfa2b307ce11efe85afcef98b", width: 300, height: 356>]
> CACHE (0.0ms)  SELECT "photos".* FROM "photos"
>
> ruby-1.9.2-p180 :014 > Photo.find_by_md5sum(@photo.md5sum)
>  => nil
> CACHE (0.0ms)  SELECT "photos".* FROM "photos" WHERE "photos"."md5sum" =
> '4f9c652dfa2b307ce11efe85afcef98b' LIMIT 1

What happens if you put this sql directly into you database manager
(using mysql command or whatever)?

Could this be a Rails 3.1 bug?

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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to