How do you scope ActiveRecord associations in Rails 3?

后端 未结 6 1782
你的背包
你的背包 2021-01-30 01:21

I have a Rails 3 project. With Rails 3 came Arel and the ability to reuse one scope to build another. I am wondering if there is a way to use scopes when defining a relationsh

6条回答
  •  天命终不由人
    2021-01-30 02:00

    Instead of scopes I've just been defining class-methods, which has been working great

    def self.age0 do
      where("blah")
    end
    

提交回复
热议问题