Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'release/new_and_improved'

  • Loading branch information...
commit 12656cd270219571cc675de1cc99c62a540eb72b 2 parents ff2d10e + b020a6c
@bokmann authored
Showing with 10 additions and 2 deletions.
  1. +1 −1  Rakefile
  2. +1 −1  VERSION
  3. +8 −0 lib/sentient_user.rb
View
2  Rakefile
@@ -10,7 +10,7 @@ begin
gem.email = "dbock@codesherpas.com"
gem.homepage = "http://github.com/bokmann/sentient_user"
gem.authors = ["bokmann"]
- gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
+ gem.add_development_dependency "shoulda", ">= 2.11.3"
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
Jeweler::GemcutterTasks.new
View
2  VERSION
@@ -1 +1 @@
-0.3.0
+0.3.1
View
8 lib/sentient_user.rb
@@ -19,6 +19,14 @@ def make_current
def current?
!Thread.current[:user].nil? && self.id == Thread.current[:user].id
end
+
+ def self.do_as(user, &block)
+ old_user = self.current
+ self.current = user
+ response = block.call unless block.nil?
+ self.current = old_user
+ response
+ end
}
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.