Skip to content

Commit e78d4c2

Browse files
committed
Adding environment helpers.
1 parent 7a13da4 commit e78d4c2

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

helpers.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
#to make our work with sinatra easier
33

44
helpers do
5+
6+
#this defines three helpers, that all test our environment:
7+
#they're called 'development?', 'test?', and 'production?'
8+
[:development, :production, :test].each do |environment|
9+
define_method "#{environment.to_s}?" do
10+
return settings.environment == environment.to_sym
11+
end
12+
end
13+
514
#this method returns the logged_in hacker
615
def current_user
716
#let's look up the Hacker by the id in the session

0 commit comments

Comments
 (0)