arel
How would I join to a subselect (a scope) using Rails 3 and Arel?
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.[详细]
2023-02-01 14:09 分类:问答Is it possible to construct dynamic aggregate columns in an ARel query that uses a join?
Here\'s a bit of sample context for my question below to help clarify what I\'m asking... The Schema Users[详细]
2023-02-01 07:27 分类:问答Use Arel for a nested set & join query and convert to ActiveRecord::Relation
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[详细]
2023-02-01 03:01 分类:问答SQL "IN subquery" when subquery can be NULL
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[详细]
2023-01-31 15:02 分类:问答How do you do a logcal or using two ActiveRelation results returning another relation
Given I have the following code class Product < ActiveRecord::Base def self.from_country(country) where(:origin_country_id => country.id)[详细]
2023-01-30 14:21 分类:问答establish_connection doesn't seem to support joins
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.[详细]
2023-01-29 18:24 分类:问答Is there a particularly elegant way to do a count query with Rails 3 / Arel?
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[详细]
2023-01-29 13:40 分类:问答Why are Rails scopes preferable, if messy controllers are faster?
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[详细]
2023-01-28 16:57 分类:问答Virtual columns in a model
Is it possible to add a virtual column to a model (not virtual attribute!)? I have following situation:[详细]
2023-01-28 14:08 分类:问答Multiple 'having' clauses blows up Rails 3 / Arel
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.[详细]
2023-01-27 11:53 分类:问答