[Rails] Re: SQL OR in RoR

2014-07-16 Thread Eric Saupe
@games = Game.sorted.where(home_team = :id OR away_team = :id, id: params [:id]) That should do the trick for you. You can have a string inside of your where statement that equates to SQL. You can then have named parameters that are used throughout the query as I have done above. In this case

[Rails] Re: SQL OR in RoR

2014-07-16 Thread Mike Oles
Thanks Eric. That did the trick. -- Posted via http://www.ruby-forum.com/. -- 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

[Rails] Re: sql query into ror query

2012-02-17 Thread ppizzq
I guess you are using Raiils 2.*, in rails 2.x, it should be Batch.find(:all, :conditions = {:id = 1}, :select = name) -- 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