Class: Iugu::SettingsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/iugu/settings_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



8
9
10
# File 'app/controllers/iugu/settings_controller.rb', line 8

def index
  redirect_to :profile_settings, :notice => flash[:notice]
end

#must_be(roles, param_name) ⇒ Object

Raises:

  • (ActionController::RoutingError)


12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/iugu/settings_controller.rb', line 12

def must_be (roles, param_name)
  access = false
  @account_user = AccountUser.(current_user.id, params[param_name])
  raise ActionController::RoutingError.new("Not Found") unless @account_user
  if roles.class == Array
    roles.each do |role|
      access = true if @account_user.is?(role)
    end
  else
    access = true if @account_user.is?(roles)
  end
  raise ActionController::RoutingError.new("Access Denied") if access == false
end