Permalink
Browse files

Added sorted_by example.

  • Loading branch information...
jnunemaker committed Dec 28, 2010
1 parent 911ace9 commit 25e5b996257494e4ab3d81cfc6227455d2420cac
Showing with 17 additions and 0 deletions.
  1. +17 −0 examples/sorted.rb
View
@@ -0,0 +1,17 @@
+$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
+require 'pp'
+require 'scam'
+
+class FeedTemplate
+ include Scam
+
+ sorted_by :title
+
+ attr_accessor :title
+end
+
+FeedTemplate.create(:id => 1, :title => 'Twitter')
+FeedTemplate.create(:id => 2, :title => 'Dribble')
+
+# Sorted by title instead of id so dribble will be first and twitter second
+pp FeedTemplate.all

0 comments on commit 25e5b99

Please sign in to comment.