search for: querymethod

Displaying 4 results from an estimated 4 matches for "querymethod".

Did you mean: querymethods
2010 Sep 08
2
Rails 2 to Rails 3 - How to convert this sql query ?
Hello all, Can someone help me with this query ? Here is the query used in rails 2. The idea here is to obtain the top 10 widgets. Widget.find(:all, :select => ''widget_type_id, COUNT(widget_type_id) AS widgettypeid'', :group => ''widget_type_id'', :order => ''widgettypeid DESC'', :limit => 10) This is deprecated and i want to port it
2012 Mar 22
1
why doesn't .where() honor polymorphism?
I love the query interface (ActiveMethod::QueryMethods), but one thing has bugged me: why doesn''t it generate calls for polymorphic associations? For example: class MyModel < ActiveRecord::Base belongs_to :parent, :polymorphic => true end I would expect: MyModel.where(:parent => a) to be equivalent to: MyModel.where(&quot...
2012 Jul 07
0
How is AR bind supposed to be used?
I''m trying to document this method, but I''m not exactly sure how it''s supposed to be used. http://api.rubyonrails.org/classes/ActiveRecord/QueryMethods.html#method-i-bind Oscar -- Oscar Del Ben -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group...
2012 May 13
2
multiple arguments to select
I read in the Rails 3 Way book that when using select(), you can, in addition to adding calculated columns (i.g. using sql aggregate functions), include additional attributes in resulting object by passing the wild card like this: Unit.select(:*,"sum(unit_type_id) as total").group("created_at").having(["created_at > ?", 2.days.ago]) That should give you the new