I need to join a table to the a select/group-by query (which includes the same table), and I\'d like to do it using Arel.
Here\'s a bit of sample context for my question below to help clarify what I\'m asking... The Schema Users
I have a model for organisations (nested set). I have a model for people. A person can have another person as deputy. An organisation is owned by a person. An organisation is only visible to the ownin
I have a query that needs to return results that are NOT matched in a sub query.The sub query can return an empty result, so I need to set adefault value (say 0) if the sub query returns an empty set
Given I have the following code class Product < ActiveRecord::Base def self.from_country(country) where(:origin_country_id => country.id)
I\'m trying to move my User account and session data into a separate database so that we can eventually share it across multiple applications.
H开发者_C百科ere\'s a Rails2 query: Foo.find_by_bar_and_baz(\'a-bar\', \'a-baz\', :select =>\'count(*) as the_count\' ).the_count.to_i
I\'ve been trying to chain Arel queries using scopes, instead of just using some long-winded logic I wrote in the controller. But the scopes are slower than just getting all the records and then sifti
Is it possible to add a virtual column to a model (not virtual attribute!)? I have following situation:
I think I\'ve found a bug in Rails 3 / Arel, but I\'m hoping someone can clarify my problem before I try and fix it and/or submit a bug report.