The log entries get passed through .squeeze(' '), I'm guessing to make
them look nicer on
the log. (activerecord/lib/active_record/connection_adapters/
abstract_adapter.rb, line 189)

Otherwise, I can't see anywhere in the code that's dropping the
spaces. Google's formatting
engine chews up spaces pretty bad, but are you *sure* you've got the
same number in
that second query?

On an unrelated note, are you really sure you want a fixed-width space-
delimited field in the DB?
Wouldn't it be easier to use multiple fields?

--Matt Jones

On Feb 26, 10:16 pm, Greg Hauptmann <greg.hauptmann.r...@gmail.com>
wrote:
> Hi,
> Is this a Rails bug?
>
> NORMAL SQL
> ?> AccountItem.find_by_sql( "select * from account_items where description =
> 'FISHERS IGA HAMILTON     HAMILTON     AU 000318'")
> => [#<AccountItem id: 1100, account_id: 5, recurring_id: nil, date:
> "2008-12-30", amount: #<BigDecimal:24fc840,'-0.4E3',4(12)>, balance:
> #<BigDecimal:24fc69c,'0.745538E4',8(12)>, description: "FISHERS IGA HAMILTON
>     HAMILTON     AU 000318", notes: nil, projection: false, created_at:
> "2009-02-08 22:29:25", updated_at: "2009-02-08 22:29:25">]
>
>
>
> WITH FINDER - DOES FIND THE RECORD
> ?> AccountItem.find(:all, :conditions => ["description = ?", 'FISHERS IGA
> HAMILTON     HAMILTON     AU 000318'] )
> => []
> EXTRACT FROM SERVER LOG - THE CREATED SQL SEEMS TO BE MISSING THE EXTRA
> SPACES??
>    [4;36;1mAccountItem Load (3.0ms) [0m    [0;1mSELECT * FROM
> `account_items` WHERE (description = 'FISHERS IGA HAMILTON HAMILTON AU
> 000318') [0m
>
> That is find method seems to be mis-translating the SQL and removing spaces.
>
> --
> Greghttp://blog.gregnet.org/
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to