default-scope
ActiveRecord STI: How can I break out of the parent class' default scope
On Rails 3.1 RC6, given class Animal < ActiveRecord::Base default_scope where(legs: 4) end The following does not work as expected:[详细]
2023-03-31 20:40 分类:问答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 分类:问答Why is my ORDER BY clause being duplicated with this ActiveRecord scope?
I have this model: class Coupon < ActiveRecord::Base default_scope order(:created_at) scope :inactive, where(:active => false)[详细]
2023-02-26 07:39 分类:问答Default_scope on a join table
I\'ve got a model setup like the following: class User has_many :items has_many :words, :through => :items[详细]
2023-02-20 13:40 分类:问答rails3 default_scope, and default column value in migration
class CreateCrews < ActiveRecord::Migration def self.up create_table :crews do |t| t.string :title t.text :description[详细]
2023-01-20 18:14 分类:问答Best way to override named_scope for has_many associations in Rails?
Note: I\'m using Rails 2.3.8, not 3. I have a Photo model with a default_scope: default_scope :conditions => [\"published = ?\", true], :order => :position[详细]
2023-01-16 03:46 分类:问答Is there a way to break out of the default_scope when using has_many?
I have a tree-like model where in all situations but one, I want to scope the results to only return the roots.[详细]
2023-01-06 18:05 分类:问答Setting default_scope according to some criteria
I\'m trying to set default scope according to some criteria determined by ana ActionController before_filter. In controller:[详细]
2022-12-27 10:26 分类:问答default_scope in rails 3
I k开发者_如何学编程now named_scope has been changed to scope in rails 3. How do I perform default_scope in rails 3, I\'ve had a good google but found nothing for defaults scopes.default_scope is ava[详细]
2022-12-25 06:16 分类:问答default_scope with :joins and :select
I tried to define a default_scope in the following way: default_scope :joins => :product, :select => \"catalog_products.*, products.*\"[详细]
2022-12-10 06:28 分类:问答