Class: Oxen::InvitationsController

Inherits:
Devise::InvitationsController
  • Object
show all
Defined in:
app/controllers/oxen/invitations_controller.rb

Instance Method Summary collapse

Instance Method Details

#create {|resource| ... } ⇒ Object

POST /resource/invitation

Yields:

  • (resource)


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/oxen/invitations_controller.rb', line 5

def create
  self.resource = invite_resource
  resource_invited = self.resource.errors.empty?
  yield resource if block_given?
  if resource_invited
    # if is_flashing_format? && self.resource.invitation_sent_at
    #   set_flash_message :notice, :send_instructions, :email => self.resource.email
    # end
    flash[:info] = t('.invited')
    render layout: false, status: 200, locals: { result: true }
  else
    flash[:error] = t('.not_invited', error:  resource.errors.collect{|v,k| k }.join(', '))
    render layout: false, status: 401, locals: { result: false, resource: self.resource }
  #
  #   respond_with resource, :location => after_invite_path_for(current_inviter)
  # else
  #   respond_with_navigational(resource) { render :new }
  end
end