anonymous-scope

    0热度

    1回答

    我有以下的命名范围: named_scope :find_all_that_match_tag, lambda { |tags| { :select => "articles.id, tags.name", :joins => :tags, :conditions => ["tags.name IN (?)",tags]} } 它工作正常

    4热度

    1回答

    我知道你可以创建Rails的命名范围,它允许你指定,然后可以在以后建立在条件: named_scope :active, :conditions => {:active => true} ... MyModel.active.find(...) 这个工程通过创建不计算,直到后来上的代理对象。我想知道的是,如果有可能创建一个名为范围的动态un? 我的意思是,有没有一种方法“富”与我可以去