Skip to content

Commit

Permalink
ruby 1.9.1 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
adivinaelnombre committed Sep 4, 2009
1 parent cca91de commit 9a39508
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 46 deletions.
90 changes: 45 additions & 45 deletions app/controllers/generated_controller.rb
Expand Up @@ -6,48 +6,6 @@ class GeneratedController < ApplicationController
before_filter :guard_entry


# second action method
def second
begin
@step = :second
@wizard = wizard_config
@title = 'Second'
@description = ''
h = (self.wizard_form_data||{}).merge(params[:user] || {})
@user = build_wizard_model(h)
if request.post? && callback_performs_action?(:_on_post_second_form)
raise CallbackError, "render or redirect not allowed in :on_post(:second) callback", caller
end
button_id = check_action_for_button
return if performed?
if request.get?
return if callback_performs_action?(:_on_get_second_form)
render_wizard_form
return
end

# @user.enable_validation_group :second
unless @user.valid?(:second)
return if callback_performs_action?(:_on_invalid_second_form)
render_wizard_form
return
end

@do_not_complete = false
if button_id == :finish
callback_performs_action?(:_on_second_form_finish)
complete_wizard unless @do_not_complete
return
end

return if callback_performs_action?(:_on_second_form_next)
redirect_to :action=>:finish
ensure
self.wizard_form_data = h.merge(@user.attributes) if (@user && !@wizard_completed_flag)
end
end


# finish action method
def finish
begin
Expand Down Expand Up @@ -125,6 +83,48 @@ def init
end
end


# second action method
def second
begin
@step = :second
@wizard = wizard_config
@title = 'Second'
@description = ''
h = (self.wizard_form_data||{}).merge(params[:user] || {})
@user = build_wizard_model(h)
if request.post? && callback_performs_action?(:_on_post_second_form)
raise CallbackError, "render or redirect not allowed in :on_post(:second) callback", caller
end
button_id = check_action_for_button
return if performed?
if request.get?
return if callback_performs_action?(:_on_get_second_form)
render_wizard_form
return
end

# @user.enable_validation_group :second
unless @user.valid?(:second)
return if callback_performs_action?(:_on_invalid_second_form)
render_wizard_form
return
end

@do_not_complete = false
if button_id == :finish
callback_performs_action?(:_on_second_form_finish)
complete_wizard unless @do_not_complete
return
end

return if callback_performs_action?(:_on_second_form_next)
redirect_to :action=>:finish
ensure
self.wizard_form_data = h.merge(@user.attributes) if (@user && !@wizard_completed_flag)
end
end

def index
redirect_to :action=>:init
end
Expand Down Expand Up @@ -339,9 +339,6 @@ def self.on_get(*args, &block)
def self.on_errors(*args, &block)
self._define_action_callback_macro('on_errors', '_on_invalid_%s_form', *args, &block)
end
def self.on_finish(*args, &block)
self._define_action_callback_macro('on_finish', '_on_%s_form_finish', *args, &block)
end
def self.on_skip(*args, &block)
self._define_action_callback_macro('on_skip', '_on_%s_form_skip', *args, &block)
end
Expand All @@ -351,6 +348,9 @@ def self.on_back(*args, &block)
def self.on_cancel(*args, &block)
self._define_action_callback_macro('on_cancel', '_on_%s_form_cancel', *args, &block)
end
def self.on_finish(*args, &block)
self._define_action_callback_macro('on_finish', '_on_%s_form_finish', *args, &block)
end
def self.on_next(*args, &block)
self._define_action_callback_macro('on_next', '_on_%s_form_next', *args, &block)
end
Expand Down
2 changes: 1 addition & 1 deletion config/environment.rb
@@ -1,7 +1,7 @@
# Be sure to restart your server when you modify this file

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.3' unless defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION = '>=2.2.1' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
Expand Down

0 comments on commit 9a39508

Please sign in to comment.