named-scope
named_scopes and all
I\'m on Rails 2.3.5. Inside my application a user could book one or more time slots for a specific day. I\'ve defined this named_scope in my Slot model:[详细]
2023-01-20 07:44 分类:问答How is it that find_by_id, etc. work on an ActiveRecord array?
Forgive me if I\'ve got my terminology wrong; I am still quite new to Ruby and Rails. For school I am working on an RoR project as part of a team. I was pair programming with a teammate, who actually[详细]
2023-01-19 01:33 分类:问答How can I sort by the average of a polymorphic child's attribute with ActiveRecord 2.3?
I have this schema: class Comment has_many :ratings, :as => :target end class Rating belongs_to :target, :polymorphic => true[详细]
2023-01-19 01:16 分类:问答Creating a named_scope for "no children" in a has_many association
I would 开发者_如何学JAVAlike to have a named_scope for blogs with zero posts. The following does not work.[详细]
2023-01-16 00:48 分类:问答Default conditions for Rails models
I have a model which has a field called deleted, which is used to mark those deleted items. So normally I would just want to query those having deleted = false items, and in some special cases to lis[详细]
2023-01-14 08:39 分类:问答named_scope conditions and timezone mismatch
Here is the setup: end_date = DateTime.parse(\'2010-01-01 12:00:00-04\') and sometimes it\'s initialized:[详细]
2023-01-11 06:09 分类:问答How do I write a named scope to filter by all of an array passed in, and not just by matching one element (using IN)
I have two models, Project and Category, which have a many-to-many relationship between them. The Project model is very simple:[详细]
2023-01-07 06:20 分类:问答Why are these named_scopes causing a duplicate INNER JOIN?
I have a Model which I am using to track permissions in a hierarchical organization using the awesome_nested_set plugin. I\'m running into a problem where two named_scopes, when chained together, are[详细]
2023-01-06 10:56 分类:问答Rails: Using named_scope which triggers a MySQL "in"
PROBLEM: I want to run a query which would trigger something like select * from users where code in (1,2,4);[详细]
2023-01-05 09:33 分类:问答rails named_scope issue with eager loading
Two models (Rails 2.3.8): User; username & disabled properties; User has_one :profile Profile; full_name & hidden properties[详细]
2023-01-03 18:40 分类:问答
加载中,请稍侯......