Sha256: 90d13445a88e7616bd89a9e958e5144dd158054a1f653fff74989735dae65e76
Contents?: true
Size: 1013 Bytes
Versions: 6
Compression:
Stored size: 1013 Bytes
Contents
module Forms module Controllers module ApplicationController def self.included(base) base.class_eval do def current_response return @current_response if defined?(@current_response) @current_response = find_or_create_response if request.session[:form_response] end def find_response response = nil begin response = Response.find(request.session[:form_response]) rescue response = nil end response end def find_or_create_response response = nil if find_response response = find_response else response = Response.create request.session[:form_response] = response.id end response end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems