Re: [Rails] How to Convert mysql query into Rails ORM?

2015-07-31 Thread Scott Ribe
Actually, you can probably stuff the condition into the "joins" of the AREL. But there is NO POINT. You have a working solution to using a very non-standard join, trying to split it up into pieces in order to force it into AREL accomplishes nothing. So like I said previously, fix the schema, or

Re: [Rails] How to Convert mysql query into Rails ORM?

2015-07-31 Thread Scott Ribe
On Jul 31, 2015, at 11:35 AM, nila1...@gmail.com wrote: > > Hi Urubatan My find_by_sql query works perfect but when I am using it as > active relation case and when and then is not working properly it is only > giving me one result . In one case, your case when is in the select clause, whi

[Rails] How to Convert mysql query into Rails ORM?

2015-07-30 Thread nilayyyy1234
I have a very simple question how can I convert mysql query as Raisl active record I am using find_by_sql but it only work for mysql when I move to heroku it doesn't work . Here is mysql query below . @message3 = User.find_by_sql("SELECT u.id,c.m_id,u.name,u.email FROM messages c,