Class: EasyTokens::TokensController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- EasyTokens::TokensController
- Defined in:
- app/controllers/easy_tokens/tokens_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #deactivate_token ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/easy_tokens/tokens_controller.rb', line 21 def create @token = Token.new(token_params) @token.owner_id = owner_resource.id if @token.save redirect_to tokens_path, notice: 'Token was successfully created.' else render :new end end |
#deactivate_token ⇒ Object
40 41 42 43 44 45 |
# File 'app/controllers/easy_tokens/tokens_controller.rb', line 40 def deactivate_token @token = Token.find(params[:token_id]) @token.touch(:deactivated_at) @token.save redirect_to tokens_path end |
#edit ⇒ Object
18 19 |
# File 'app/controllers/easy_tokens/tokens_controller.rb', line 18 def edit end |
#index ⇒ Object
10 11 12 |
# File 'app/controllers/easy_tokens/tokens_controller.rb', line 10 def index @tokens = Token.all end |
#new ⇒ Object
14 15 16 |
# File 'app/controllers/easy_tokens/tokens_controller.rb', line 14 def new @token = Token.new end |
#update ⇒ Object
32 33 34 35 36 37 38 |
# File 'app/controllers/easy_tokens/tokens_controller.rb', line 32 def update if @token.update(token_params) redirect_to tokens_path, notice: 'Token was successfully updated.' else render :edit end end |