Sha256: e2b2d5e958c3e2b5ae65ecbafd15d3ea1748e1bc9dcc53776b680ea2291afb18

Contents?: true

Size: 736 Bytes

Versions: 2

Compression:

Stored size: 736 Bytes

Contents

# Because we want to use the session, we need to inherit from ApplicationController
# This is currently very brittle....need to think this one through further.
require_dependency 'application' if Object.const_defined?(:RAILS_ENV)
class TimecopController < ApplicationController
  
  # verify :method => 'post'
  skip_filter :handle_timecop_offset
  
  def update
    year, month, day, hour, min, sec = params[:year], params[:month], params[:day], params[:hour], params[:min], params[:sec]
    session[:timecop_adjusted_time] = Time.local(year, month, day, hour, min, sec)
    render :status => 200, :nothing => true
  end
  
  def reset
    session[:timecop_adjusted_time] = nil
    render :status => 200, :nothing => true
  end
  
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
jtrupiano-timecop-console-0.1.0 lib/timecop-console/controllers/timecop_controller.rb
timecop-console-0.1.0 lib/timecop-console/controllers/timecop_controller.rb