ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Rolling with Ruby on Rails, Part 2
Subject:   "Showing recipes in a category" code
Date:   2005-03-08 08:36:56
From:   curth
Response to: "Showing recipes in a category" code

Even better, I could have used:



def list
@category = @params['category']
@recipes=Recipe.find_by_category(@category)
end

This is an example of dynamic finders, where "find_by_" can be appended with a column name.



1 to 1 of 1
  1. "Showing recipes in a category" code
    2005-03-10 02:21:34  aeden [View]

    • Curt Hibbs photo "Showing recipes in a category" code
      2005-03-10 03:37:24  Curt Hibbs | O'Reilly AuthorO'Reilly Blogger [View]

      • "Showing recipes in a category" code
        2005-03-11 15:46:16  automat_svet [View]

        • "Showing recipes in a category" code
          2005-04-05 12:45:39  co_banzai [View]

          • "Showing recipes in a category" code
            2005-04-22 03:38:42  xeal [View]

        • Curt Hibbs photo "Showing recipes in a category" code
          2005-03-11 16:57:37  Curt Hibbs | O'Reilly AuthorO'Reilly Blogger [View]

          • "Showing recipes in a category" code
            2005-03-14 07:30:33  automat_svet [View]

1 to 1 of 1