Class: AuthHelpers::Controller::Confirmable
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- AuthHelpers::Controller::Confirmable
- Includes:
- Helpers, InheritedResources::BaseHelpers
- Defined in:
- lib/auth_helpers/controller/confirmable.rb
Instance Method Summary collapse
-
#create(&block) ⇒ Object
(also: #create!)
POST /account/confirmation POST /account/confirmation.xml.
-
#new(&block) ⇒ Object
(also: #new!)
GET /account/confirmation/new.
-
#show(&block) ⇒ Object
(also: #show!)
GET /account/confirmation?account=xxxx GET /account/confirmation.xml?account=xxxx.
Methods included from Helpers
Instance Method Details
#create(&block) ⇒ Object Also known as: create!
POST /account/confirmation POST /account/confirmation.xml
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/auth_helpers/controller/confirmable.rb', line 22 def create(&block) object = get_or_set_with_send(:find_and_resend_confirmation_instructions, params[self.instance_name]) respond_block, redirect_block = select_block_by_arity(block) if object.errors.empty? (:notice, 'We sent confirmation instructions to your email, please check your inbox.') respond_to_with_dual_blocks(true, block) do |format| format.html { redirect_to_block_or_scope_to(redirect_block, :session) } format.all { head :ok } end else (:error) = { :with => object.errors, :status => :unprocessable_entity } respond_to_with_dual_blocks(false, block, ) do |format| format.html { render :action => 'new' } end end end |
#new(&block) ⇒ Object Also known as: new!
GET /account/confirmation/new
14 15 16 17 |
# File 'lib/auth_helpers/controller/confirmable.rb', line 14 def new(&block) object = get_or_set_with_send(:new) respond_to(:with => object, &block) end |
#show(&block) ⇒ Object Also known as: show!
GET /account/confirmation?account=xxxx GET /account/confirmation.xml?account=xxxx
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/auth_helpers/controller/confirmable.rb', line 46 def show(&block) object = get_or_set_with_send(:find_and_confirm, params[self.instance_name]) respond_block, redirect_block = select_block_by_arity(block) if object.errors.empty? (:notice, '{{resource_name}} was successfully confirmed.') respond_to_with_dual_blocks(true, block) do |format| format.html { redirect_to_block_or_scope_to(redirect_block, :session) } format.all { head :ok } end else (:error, object.errors.on(:perishable_token)) = { :with => object.errors, :status => :unprocessable_entity } respond_to_with_dual_blocks(false, block, ) do |format| format.html { redirect_to :action => 'new' } end end end |