代码之家  ›  专栏  ›  技术社区  ›  sscirrus

Rails 3活动记录问题

  •  0
  • sscirrus  · 技术社区  · 16 年前

    我有几个问题要问你Rails 3专家那里。你怎么能做到以下几点?

    @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)
    
    1 回复  |  直到 16 年前
        1
  •  1
  •   MunkiPhD    16 年前

    我相信你要找的是 scopes

    推荐文章