Skip to content
This repository has been archived by the owner on Jul 18, 2019. It is now read-only.

Commit

Permalink
rails-api with cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
pocke committed Jun 23, 2016
1 parent 9c8f432 commit 11ccaf1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class ApplicationController < ActionController::API
include ActionController::Cookies

def root
t = (cookies['count'] || 1).to_i
cookies['count'] = t + 1
Expand Down
3 changes: 3 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@ class Application < Rails::Application

# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true

config.middleware.use ActionDispatch::Cookies
# config.api_only = false # if you use session, use this line instead of the above.
end
end

0 comments on commit 11ccaf1

Please sign in to comment.