VocabReminder
English dictionary with notifications so you won't forget what you're studying!
Click here for more info about the app
VocabQuiz
The app that quizzes and scores you on your vocabulary!
Click here for more info about the app

Reusing Scopes (Formerly Named_scope) In Rails 3

       

You can easily chain scopes together in your models. class Article < ActiveRecord::Base scope :ordered, order('position ASC') scope :published, ordered.where('published = ?', true) scope :for_homepage, published.limit(3) end

Article.for_homepage.to_sql

=> SELECT \"articles\".* FROM \"articles\" WHERE (published = 't') ORDER BY position LIMIT 3

Tagged w/ #active record #models #named scopes #scopesruby on rails