Permalink
Browse files

move example models into {posts,users}.rb

  • Loading branch information...
garybernhardt committed Jan 11, 2012
1 parent 2e6b712 commit ce619b44944ddc9e47502edf1273f0185f836b84
Showing with 49 additions and 35 deletions.
  1. +12 −0 design_experiment/fake_raptor.rb
  2. +0 −28 design_experiment/models.rb
  3. +24 −7 design_experiment/posts.rb
  4. +13 −0 design_experiment/users.rb
@@ -0,0 +1,12 @@
+# This file exists to make the example load.
+
+require "raptor/shorty"
+
+module Raptor
+ module Model
+ def delegate *args
+ end
+ end
+end
+
+
@@ -1,28 +0,0 @@
-module Models
- class User
- extend Raptor::Model
- delegate [:email, :posts] => :@record
-
- def anonymous?; false; end
- end
-
- class AnonymousUser
- def anonymous?; true; end
- end
-
- class Post
- extend Raptor::Model
- delegate [:title, :body] => :@record
-
- def publish
- @record.update_attributes(:published => true)
- @record.save!
- end
-
- def save_as_draft
- @record.update_attributes(:published => false)
- @record.save!
- end
- end
-end
-
View
@@ -1,10 +1,4 @@
-require "raptor/shorty"
-
-module Injectables
- def self.post_params(params)
- params.fetch(:post)
- end
-end
+require_relative "fake_raptor"
module Interactors
class CreatePost
@@ -28,3 +22,26 @@ def self.create(current_user, post_params)
end
end
+module Injectables
+ def self.post_params(params)
+ params.fetch(:post)
+ end
+end
+
+module Models
+ class Post
+ extend Raptor::Model
+ delegate [:title, :body] => :@record
+
+ def publish
+ @record.update_attributes(:published => true)
+ @record.save!
+ end
+
+ def save_as_draft
+ @record.update_attributes(:published => false)
+ @record.save!
+ end
+ end
+end
+
View
@@ -10,3 +10,16 @@ def current_user(session)
end
end
+module Models
+ class User
+ extend Raptor::Model
+ delegate [:email, :posts] => :@record
+
+ def anonymous?; false; end
+ end
+
+ class AnonymousUser
+ def anonymous?; true; end
+ end
+end
+

0 comments on commit ce619b4

Please sign in to comment.