Re: [Rails] Re: Rails Advance query CASE WHEN method not working

2015-07-31 Thread nilayyyy1234
No user table does not contail foreign key user_one infact message table contain user_one when I am using this has_many :messages,class_name: "Message", foreign_key: "user_one" I in user model I ma getting the error what should I do to get the exact result help

Re: [Rails] Re: Rails Advance query CASE WHEN method not working

2015-07-31 Thread nilayyyy1234
I am adding the user model and message model have a look and if it is not enough let me know . https://gist.github.com/nwoow/62f45077f340eb8ffe0b On Friday, July 31, 2015 at 11:53:50 PM UTC+5:30, Elizabeth McGurty wrote: > > I would add that we also need to see the Message and User Models, eg,

Re: [Rails] Re: Rails Advance query CASE WHEN method not working

2015-07-31 Thread nilayyyy1234
I am adding the user model and message model have a look and if it is not enough let me know . https://gist.github.com/nwoow/62f45077f340eb8ffe0b On Friday, July 31, 2015 at 11:53:50 PM UTC+5:30, Elizabeth McGurty wrote: > > I would add that we also need to see the Message and User Models, eg,

[Rails] Re: Rails Advance query CASE WHEN method not working

2015-07-31 Thread nilayyyy1234
I am attaching the schema a full schema of my code there are three tables involved first one is messages and other one users and next one is message_replies these three table he I am trying to get the result of all messages using case and when query . I am attaching a link for schema : https://gis

Re: [Rails] Re: Rails Advance query CASE WHEN method not working

2015-07-31 Thread nilayyyy1234
I am attaching the schema a full schema of my code there are three tables involved first one is messages and other one users and next one is message_replies these three table he I am trying to get the result of all messages using case and when query . I am attaching a link for schema : https://gis

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

2015-07-31 Thread nilayyyy1234
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 . On Friday, July 31, 2015 at 10:37:47 PM UTC+5:30, Urubatan wrote: > > There is something wrong with your query, your case sta

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

2015-07-31 Thread nilayyyy1234
The table structure of the message table had these fileds m_id as primary key and user_one and user_two and created at and updated at these are the fields in my Table When I am using find_by_sql it work perfect but when I am using active record only then I am getting the problem I need a proper

[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,