Skip to content

Instantly share code, notes, and snippets.

@clemens
Created March 6, 2010 17:57
Show Gist options
  • Select an option

  • Save clemens/323827 to your computer and use it in GitHub Desktop.

Select an option

Save clemens/323827 to your computer and use it in GitHub Desktop.
class Post < ActiveRecord::Base
scope :published, where(:published => true)
scope :published, :conditions => { :published => true }
end
# the first one fails when loading the environment (e.g. when migrating the database), if the posts table doesn't exist
# the second one (always) works, independent of whether or not the table exists
# ... or so it seems ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment