thanks. I fixed it. Sure I will consider your suggestion.

On Wed, Oct 28, 2015 at 1:50 PM, Colin Law <clan...@gmail.com> wrote:

> On 28 October 2015 at 07:00, honey ruby <emailtohoneyr...@gmail.com>
> wrote:
> > Hi all,
> >
> > In a table there is column called village which is text datatype. Now my
> > question is few records will have 1,2 under village column some records
> will
> > have only 2 or 1. when I do query I should be able to select those
> records
> > which has 1,2 . If I want to select all the records of village(2). How
> can I
> > do this in rails query.
> >
> > Tried with Like and IN (?) in query but did not work
> >
> > City.find(:all, :conditions => ["village LIKE ?",2])
> > City.find(:all, :conditions => ["village IN (?)",2])
> >  as it is text datatype and if I pass 1,2 I am able to get the records
> but
> > while passing single value like 1 or 2
> >
> > Kindly suggest how to get it
>
> Don't store the data like that, it will cause you endless problems and
> you will look back in the future and ask why you did it that way.
> Possibly it should be in separate fields, or even in a separate table.
> It depends what the data represents.  If you provide the context then
> it may be possible to suggest the best alternative.
>
> Colin
>
> --
> 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 rubyonrails-talk+unsubscr...@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvzeWMA7nVB1WW9ZAE%2BW15JTuFpEjdko125DpL0h4BVGA%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAOKUzC%3DOK1P%3D%2BzSJeS7fO7eH-UzGmrQrUnM7oggDcSK4AMKAuw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to