Web Development  >>  Ruby On Rails

Railscasts Week 5

Language : English Quality : High Has Audio : true Source : showmedo Media : Flash
Let Ryan Bates take you through a growing series of great Rails tips.

Tags: Ruby On Rails, Ruby, Web Development, Screencast, Showmedo, Session, Model,     [SUGGEST  A  TAG]

Resources referenced in this screencast
  • Ruby on Rails
  • Dangers of Model in Session

    Be careful when storing a model in a session. It will behave differently than you expect and can easily get out of sync with the database. Instead of storing the model directly in the session, store the id to the model and use that to fetch it from the database.

    Performing Calculations on Models

    Did you know ActiveRecord provides class methods for performing calculations on models? You can even use these methods through associations.

    Fun with Find Conditions

    You can pass more than simple strings to find conditions. Arrays, ranges, and nil values can be passed as well. In this episode you will see the tricks involved with passing these odd objects to find conditions


    Articles Realted to this Topic

    [SUGGEST  A  ARTICLE]
    ActiveRecord Calculations
    This calculates aggregate values in the given column: Methods for count, sum, average, minimum, and maximum have been added as shortcuts. Options such as :conditions, :order, :group, :having, and :joins can be passed to customize the query
    Rails find :conditions
    A good solution for this problem is the ez_where plugin by Ezra Zygmuntowicz and Fabien Franzen. It includes new find_where method in your ActiveRecord models which takes a code block building the conditions with a quite nifty syntax
    19 Rails Tricks Most Rails Coders Don't Know
    When looking at my own Rails code and that of the community as a whole, I often see places where certain Rails techniques could have been used, but weren't. As much for my own memory as yours, I thought I'd list down some Rails tricks and tips that can make your application or code more efficient