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

2015-07-31 Thread Scott Ribe
On Jul 31, 2015, at 12:09 PM, Nilay Singh li...@ruby-forum.com wrote: Fixing a schema is other thing this very straight forward question how can I generate the query which I am using in find_by_sql or is there any mechanism where I can select two tables without join and use the case and when

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

2015-07-31 Thread Rodrigo Urubatan Ferreira Jardim
the query is possible you need to show us your schema for a better answer (or at least the parts of the schema that are involved in the question) and I'm having problems understanding what you write, there are no commas, no points, no new lines, ... Rodrigo Urubatan Ferreira Jardim Architect,

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

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 Nilay Singh
Fixing a schema is other thing this very straight forward question how can I generate the query which I am using in find_by_sql or is there any mechanism where I can select two tables without join and use the case and when . Or can you tell me how to right exact query where I can get the result

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 Elizabeth McGurty
I would add that we also need to see the Message and User Models, eg, managing primary key outside of Rails convention. Liz On Friday, July 31, 2015 at 2:14:42 PM UTC-4, Urubatan wrote: the query is possible you need to show us your schema for a better answer (or at least the parts of the

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 :

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

2015-07-31 Thread Elizabeth McGurty
What strikes me immediately is the question, does your User table contain the foreign key user_one? Otherwise, can I offer some advise? Try to calm down. The process in Rails development isn't always easy, sometimes it is down-right difficult. In my experience here, folks are genuinely

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 me