named-scope
Rails has_many with finder_sql and name_scope in combination return nil
For example lets say you have: class Model < AR::Base has_many :somethings, :finder_sql => \"SELECT * FROM somethings\"[详细]
2023-04-11 17:03 分类:问答What is Object::private and Object::public in Ruby?
What are these methods and how bad is it to override them? irb(main):001:0> Object::respond_to?(\'private\', true)[详细]
2023-04-11 09:04 分类:问答When using a Scope, when should one use hash notation vs a string?
I\'m just starting to get familiar with scopes and i see that they can be written using strings OR hash notation.[详细]
2023-04-05 14:35 分类:问答Rails gem rails3-jquery-autocomplete how to scope by user
I\'m using the Rails gem rails3-jquery-autocomplete to add categories to posts. I would like to restrict the search to include only categories that belong to the current user or post\'s author in th[详细]
2023-04-01 13:18 分类:问答Is it possible to negate a scope in Rails?
I have the following scope for my class called Collection: scope :with_missing_coins, joins(:coins).where(\"coins.is_missing = ?\", true)[详细]
2023-03-28 03:46 分类:问答Alternative to default_scope in ActiveRecord
I\'m facing a problem with changing the functionality of an app and having to re-write about 700 method calls that now need to be scoped.[详细]
2023-03-25 22:52 分类:问答named_scope in rails 2
I have two models.. Member and MemberMeeting . Member has_many member开发者_Python百科_meetings. I have written a named_scope in Member model such that it does a join operation on the member_meeting[详细]
2023-03-25 13:08 分类:问答Rails 3 default scope, scope with override
I have a situation where the behavior of an existing app is changing and it\'s causing me a major headache.[详细]
2023-03-24 13:57 分类:问答Problem with named_scope causes error in will_paginate - how to include group_by in count?
[rails 2.3.12] named_scope: named_scope :order_by_price, lambda {{:joins => :variants, :group => \"products.id\", :order => \"MAX(price)\"}}[详细]
2023-03-22 11:03 分类:问答Using Object scopes in rails 3.1
In my project, I have several models that use a number of scopes that I use to run daily tasks (see shortened code below).[详细]
2023-03-22 04:32 分类:问答