i have to fine those article which have state id 3 OR 4 and skill_id = params[:browsed_by_skill] @articles = Article.find(:all,:conditions => ["state = ? AND skill_id = ? ", [''3'', ''4''], params[:browsed_by_skill]]) Getting error this Mysql::Error: Operand should contain 1 column(s): SELECT `articles`.* FROM `articles` WHERE (state = ''3'',''4'' AND skill_id = ''5'' ) any suggetions , THanks in advance -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/yeA73ihuzAAJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
solved @articles = Article.find(:all,:conditions => ["state in (?) AND skill_id = ? ", [''3'', ''4''], params[:browsed_by_skill]]) Thanks -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/qctcYMJ4kjMJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Wed, Jul 6, 2011 at 1:59 PM, Rajeev Kannav Sharma < rajeevsharma86-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> solved > @articles = Article.find(:all,:conditions => ["state in (?) > AND skill_id = ? ", [''3'', ''4''], params[:browsed_by_skill]]) > Thanksyou can do states = [''3'', ''4''] skill_id = params[:browsed_by_skill] Article.where(;state => states, :skill_id => skill_id) states in the above code can be a range or an array or a single integer.> > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/qctcYMJ4kjMJ. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.com -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.