Class: EasyTokens::TokensController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/easy_tokens/tokens_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/easy_tokens/tokens_controller.rb', line 24

def create
  @token = Token.new(token_params)
  @token.owner_id = owner_resource.id

  if @token.save
    redirect_to @token, notice: 'Token was successfully created.'
  else
    render :new
  end
end

#editObject



21
22
# File 'app/controllers/easy_tokens/tokens_controller.rb', line 21

def edit
end

#indexObject



10
11
12
# File 'app/controllers/easy_tokens/tokens_controller.rb', line 10

def index
  @tokens = Token.all
end

#newObject



17
18
19
# File 'app/controllers/easy_tokens/tokens_controller.rb', line 17

def new
  @token = Token.new
end

#showObject



14
15
# File 'app/controllers/easy_tokens/tokens_controller.rb', line 14

def show
end

#updateObject



35
36
37
38
39
40
41
# File 'app/controllers/easy_tokens/tokens_controller.rb', line 35

def update
  if @token.update(token_params)
    redirect_to @token, notice: 'Token was successfully updated.'
  else
    render :edit
  end
end