Class: Adeia::TokensController

Inherits:
ApplicationController show all
Defined in:
app/controllers/adeia/tokens_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
# File 'app/controllers/adeia/tokens_controller.rb', line 16

def create
  @token = Token.new(token_params)
  if @token.save
    redirect_to tokens_path, success: t('adeia.tokens.create.success')
  else
    render 'new'
  end
end

#destroyObject



36
37
38
39
# File 'app/controllers/adeia/tokens_controller.rb', line 36

def destroy
  @token.destroy
  redirect_to tokens_path, success: t('adeia.tokens.destroy.success')
end

#editObject



25
26
# File 'app/controllers/adeia/tokens_controller.rb', line 25

def edit
end

#indexObject



7
8
9
10
# File 'app/controllers/adeia/tokens_controller.rb', line 7

def index
  @table = TokenTable.new(self, @tokens)
  @table.respond
end

#newObject



12
13
14
# File 'app/controllers/adeia/tokens_controller.rb', line 12

def new
  @token = Token.new(is_valid: true)
end

#updateObject



28
29
30
31
32
33
34
# File 'app/controllers/adeia/tokens_controller.rb', line 28

def update
  if @token.update_attributes(token_params)
    redirect_to tokens_path, success: t("adeia.tokens.update.success")
  else
    render 'edit'
  end
end