Class: Api::BaseController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Api::BaseController
- Defined in:
- lib/generators/petergate_api/templates/app/controllers/api/base_controller.rb
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#current_city ⇒ Object
13 14 15 |
# File 'lib/generators/petergate_api/templates/app/controllers/api/base_controller.rb', line 13 def current_city @current_city ||= current_user.try(:city) end |
#current_user ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/generators/petergate_api/templates/app/controllers/api/base_controller.rb', line 3 def current_user @user ||= begin if (@connection = Api::Connection.find_by(token: request.headers["Authorization"])).present? @user = @connection.user else nil end end end |