module Stepper::ControllerAdditions::ClassMethods
Public Instance Methods
has_steps(*args)
click to toggle source
Sets up create
, update
, new
actions for controller and before filter for load resource. If you use cancan or load resource in other way it will get loaded resource.
First parameters can be name of resource, for example:
class CompaniesController < ApplicationController has_steps :my_company end
It will load or build resource in +@my_company+ variable
First argument it isn't required:
class CompaniesController < ApplicationController has_steps end
In this case resource will be loaded or built into +@company+ variable
You can setup redirection for each save
, previous_step
, next_step
and finish
step to other action than default, options should have after
prefix:
class CompaniesController < ApplicationController has_steps :redirect_to => { :after_save => {:action => :new} } end
You can set proc that will be executed for current controller:
class CompaniesController < ApplicationController has_steps :redirect_to => { :after_finish => proc{|controller, resource| controller.show_companies_url(resource)} } end
# File lib/stepper/controllers/controller_additions.rb, line 38 def has_steps(*args) include InstanceMethods stepper_resource_class.add_before_filter(self, *args) end
stepper_resource_class()
click to toggle source
# File lib/stepper/controllers/controller_additions.rb, line 43 def stepper_resource_class ControllerResource end