arel
Rails 3 has_many :through + join table conditions / scoping
I\'m working on an app that has the models User and Project, and User can be assigned to multiple Projects, via ProjectUser, with a role (e.g. Developer, Designer).[详细]
2023-04-13 05:53 分类:问答Rails 3: scope is not true
How do I convert the following into something that works on sqlite and mysql? Note, internal is nullable.[详细]
2023-04-12 22:09 分类:问答Possible override the way count works, or finding a better way, altogether to do this
I have this scope in my artist model that gives me the artists, in the order of their popularity within a certain time period. popularity in the popularity_caches table is computed every day.[详细]
2023-04-10 13:33 分类:问答Ordering records by frequency with Arel
How do I retrieve a set of records, ordered by count in Arel? I have a model which tracks how many views a product get. I want to find the X most frequently viewed products over the last Y days.[详细]
2023-04-08 17:29 分类:问答ActiveRecord combining relations
I\'m wondering if there\'s a nicer way to do this: I have 2 complex relations with multiple joins joining to Table D. I want to combine/join them to get the Table D records. The following works but i[详细]
2023-04-08 12:15 分类:问答How to do joins on subqueries in AREL within Rails
I have a simple model class User has_many :logs class Logs related in the usual way through the foreign key logs.user_id. I\'m trying to do the following using Arel and according to the Arel doc[详细]
2023-04-07 04:15 分类:问答Arel subselects with ActiveRecord?
I\'m using a slightly-modified version of the geocoded gem which returns this query when I call near on my model (calling Deal.near(southwest), where southwest is an array of geo coordinates):[详细]
2023-04-06 07:44 分类:问答Eager Loading with "has many through" -- do I need Arel?
I have three tables: users, members, projects.The middle is a join table expressing a has-many-through between the other two tables; and it has some attributes of interest, including join_code and act[详细]
2023-04-05 15:58 分类:问答Arel: order by association count
Here is what I\'m trying to do class Question has_many :votes end class Vote belongs_to :question end I want to find all questions ordered by the numb开发者_Go百科er of votes they have. I want to[详细]
2023-04-04 03:06 分类:问答How do I make an ActiveRecord scope that doesn't affect the query in Rails 3 using Arel (presumably)?
Essentially I am looking for a no-op type of relation to apply to a chain of scopes. Lets say I have a chain of scopes:[详细]
2023-04-03 02:49 分类:问答