> 2013/5/7 Colin Law <[email protected]>
>>
>> On 7 May 2013 13:17, tamouse mailing lists <[email protected]>
>> wrote:
>> > On Tue, May 7, 2013 at 1:08 AM, Maddy <[email protected]> wrote:
>> >> Hi Folks,
>> >>
>> >> My search fields,
>> >>
>> >> Firstname*
>> >> Lastname*
>> >> MI - Middle initial
>> >> State*
>> >> ID
>> >> Birthday
>> >>
>> >> when people will search John Bolton in any state for example AL
>> >> (Alabama),
>> >> all John Bolton names in only AL will show up.
>> >> So if there are 3 John Bolton with different middle MIs, they will
>> >> show, for
>> >> example
>> >> John A. Bolton
>> >> John W. Bolton
>> >> John O. Bolton and so on...
>> >>
>> >> I used this code in my model, But it show an error,
>> >>
>> >> def
>> >>
>> >> self.search_my_new_contact(first_name,last_name,initial,inimate_id,state,dob)
>> >>   find(:all, :include=>[:address_book], :conditions => ["'( LOWER
>> >> (address_books.first_name) LIKE ? AND LOWER (address_books.last_name)
>> >> LIKE ?
>> >> AND LOWER (address_books.state_name) LIKE ?)' AND '(LOWER
>> >> (address_books.initial) LIKE ? OR LOWER
>> >> (address_books.inmate_id_number)
>> >> LIKE ? OR LOWER (address_books.birthday) LIKE ?)'",
>> >> "#{first_name.downcase}","#{last_name.downcase}","#{initial.downcase}",
>> >> "#{inimate_id.downcase}", "#{state.downcase}","#{dob.downcase}"])
>> >> end
>> >>
>> >> ActiveRecord::StatementInvalid in InimateLocatorsController#index
>> >> ...
>> > MySQL is complaining about the double dot in this section:
>> >
>> > WHERE ( ( LOWER (address_books.first_name) LIKE 'remo' AND LOWER
>> > (address_books.last_name)
>> > LIKE 'nandi' AND LOWER (address_books..state_name) LIKE 'ar'))
>> >
>> >
>> > But I don't see how it's getting that from your code:
>> >
>> > '( LOWER (address_books.first_name) LIKE ? AND LOWER
>> > (address_books.last_name) LIKE ? AND LOWER (address_books.state_name)
>> > LIKE ?)'
>> >
>> > I only see a single dot in address_books.state_name so I'm really not
>> > sure where the problem stems from...
>>
>> I wonder whether there is a non-printing character in the source code
>> "LOWER (address_books.state_name)" which is appearing as the extra dot
>> in the sql.  Try deleting and re-typing that bit to see if it makes a
>> difference.  That is of course if you have not already realised that
>> the code you posted is not actually the code in the source file.
>>
>> Colin
>>

On Wed, May 8, 2013 at 2:56 AM, Yuichi Matsuda <[email protected]> wrote:
> in the source given, i see something like
>
>  :conditions => ["'( LOWER (
>

   "
   '
   ( LOWER...



> (address_books.birthday) LIKE ?)'",

   LIKE
   ?
   )
   '
   "
>
> is theres a extra quote?

not that i can see

>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to