Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added an example.

  • Loading branch information...
commit 52c3fcf6af14d078d179833b18103a18d9163f61 1 parent 019a0f9
@jnunemaker authored
Showing with 28 additions and 0 deletions.
  1. +28 −0 examples/simple.rb
View
28 examples/simple.rb
@@ -0,0 +1,28 @@
+$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
+require 'pp'
+require 'scam'
+
+class FeedTemplate
+ include Scam
+
+ attr_accessor :title
+end
+
+FeedTemplate.create(:id => 1, :title => 'Twitter')
+FeedTemplate.create(:id => 2, :title => 'Dribble')
+
+pp FeedTemplate.all
+
+# Enumerable is on the class so you can just iterate it
+FeedTemplate.each do |tpl|
+ pp tpl
+end
+
+# detect, select, include, etc
+pp FeedTemplate.detect { |tpl| tpl.title == 'Twitter' }
+
+# find by id
+pp FeedTemplate.find(2)
+
+# works with string id
+pp FeedTemplate.find('2')
Please sign in to comment.
Something went wrong with that request. Please try again.