Champs ..
Coming here for the first time ..
Actually i am searching for a string in an array using an exists like
this ..
Area.exists?(:name = whatEverName)
But the crisis is that how can i call this case insensitively .. I mean
how can i check that this name(whatEverName) is available or not in Area
array case insensitively .. May be u guyz can find out other way than
exists also ..
Nopes .. Not Working ..
Actually (:name => area_name) whole gives me a string which is to be
checked for existence ..
So probably we people can not do any operations on area_name alone ..
Correct .. q
If Area is an model object then you can put it in conditions itself as below
Area.find :all :conditions => [โname = lower(?)โ, area_name.down_case]
Champs ..
Above both are not working ..
May be u people are not getting me properly ..
Sorry, Area is an model object ..
I had tried these four .. But none of them are working fine for
"Area.exists? (:name => area_name)"
This really should be working. Check the SQL generated in the log file
and test that directly against your database.
I would then tweak the SQL statement until you find what's working,
then work it back into ActiveRecord
This really should be working. Check the SQL generated in the log file
and test that directly against your database.
I would then tweak the SQL statement until you find what's working,
then work it back into ActiveRecord
Dude .. Sql itself is not generating ..
Actually what happens is i had given the creation of sql in if condition
..
I mean if this matches then only save ..
I'll tell u people the whole scenerio ..
Area is a model name ..
Area.exists?(:name => area_name) .. area name is coming from mine
textbox value and i am cheking it against to the records name of the
area table .. fine ..
Lets suppose now that my area table have a field Bangalore and mine
value coming from textbox is bangalore or may be banGalore .. i mean
whatever .. So how can i map this .. ?
And also if m giving Bangalore value it get stored ..
If this will map then only it'll save to the database ..
This is my question ..