Thursday 15 July 2010

'Unknown key(s): having' In Ruby on Rails ActiveRecord Find Method -


I have a project that would sort out one of my active record models and return a relevant record Aggregate function is required to be used. The problem is that despite this being used on many rail tutorials, and despite being in the online ActiveRecord documentation, my rail application throws this error on me when the method is called:

  Unknown key):  

Any ideas why?

I'm using it like this (I have : group = & gt; which works before, without: code is implemented properly, Is not filtered - which I want.):

  question.find (: all,: select => "questions.id, questions.text, questions.question_type_id, questions. Meta, questions.max_answer_length, real as CAST (COUNT (form_questions.id)) / CAST ((from application_forms to SELECT COUNT (*) AS) ASpr1 ",: joins =" ​​Gtc: max_answer_length ",: having => [ "Expr1" = 0. ", 0.75])  

Are you sure That Is the version of your version of ROR updated? ActiveRecord offers support for: (I think) for 2 years now, but maybe you're just using an older version?

If you can not update the environment then you can use HAVING section after adding it to the end of your group.

Best Wishes, Fabian


No comments:

Post a Comment