Class: RailsCaddy

Inherits:
Object
  • Object
show all
Defined in:
lib/rails-caddy.rb,
lib/rails-caddy/errors.rb

Defined Under Namespace

Classes: SessionControllerNotFoundError, SessionUninitializedError

Class Method Summary collapse

Class Method Details

.define_routes!(map) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rails-caddy.rb', line 29

def self.define_routes!(map)
  # Session editing routes
  map.update_session '/rails_caddy/update_session/:id', :controller => 'rails_caddy', :action => 'update_session'
  map.remove_session '/rails_caddy/remove_session/:id', :controller => 'rails_caddy', :action => 'remove_session'

  # Timecop routes
  map.timecop_update '/rails_caddy/timecop_update', :controller => 'rails_caddy', :action => 'timecop_update'
  map.timecop_reset '/rails_caddy/timecop_reset', :controller => 'rails_caddy', :action => 'timecop_reset'

  # Sanitize Email routes
  map.set_sanitize_email_address '/rails_caddy/set_sanitize_email_address', :controller => 'rails_caddy', :action => 'set_sanitize_email_address'
  map.unset_sanitize_email_address '/rails_caddy/unset_sanitize_email_address', :controller => 'rails_caddy', :action => 'unset_sanitize_email_address'
end

.init!Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rails-caddy.rb', line 14

def self.init!
  # extend ActionController::Base
  ActionController::Base.send(:include, TimecopController::ActionControllerExtensions)
  ActionController::Base.send(:include, SanitizeEmailController::ActionControllerExtensions)
  
 # Pull in the RailsCaddyController
 require 'rails-caddy/controllers/rails_caddy_controller'
     
  # Lastly, let's add our views to the load path...
  ActionController::Base.append_view_path(File.expand_path(File.join(File.dirname(__FILE__), "rails-caddy", "views")))
  
  # we will inspect this at a few places in the consuming rails app, most notably config/routes.rb
  $rails_caddy_activated = true
end