开发者

Rails 3 ActiveRecord Questions

开发者 https://www.devze.com 2023-01-20 02:36 出处:网络
I have a few queries for you Rails 3 gurus out there. How can you accomplish the following? The following pse开发者_StackOverflow中文版udocode is currently invalid. Thanks all.

I have a few queries for you Rails 3 gurus out there. How can you accomplish the following?

The following pse开发者_StackOverflow中文版udocode is currently invalid. Thanks all.

@items = (@itemsA + @itemsB).order("name ASC")

@item = Item.where("type = ?" and "condition = ?", "book", "new")

@commenteditems = Item.find_all_by_type_and_condition("book", "new").include("notes").select("item[name]", "notes[note]")

@selecteditems = @items.where("select = ?", true)


I believe what you're looking for is scopes.

0

精彩评论

暂无评论...
验证码 换一张
取 消