Class: Tramway::Api::V1::UsersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ApplicationController
- Tramway::Api::V1::UsersController
- Includes:
- ClassNameHelpers
- Defined in:
- app/controllers/tramway/api/v1/users_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
#render_error_with_text, #render_errors_for, #snake_case
Methods inherited from ApplicationController
#authenticate, #not_found, #unauthorized
Instance Method Details
#create ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/tramway/api/v1/users_controller.rb', line 9 def create user_form = sign_up_form_class_name(user_based_model).new user_based_model.new # Implement JSON API spec here if user_form.submit snake_case params[:data][:attributes] token = ::Knock::AuthToken.new(payload: { sub: user_form.model.uuid }).token # FIXME: refactor this bullshit user_form.model.reload serialized_user = OpenStruct.new( user_form.model.attributes.merge( authentication_token: token, id: user_form.model.uuid ) ) render json: serialized_user, status: :created else render_errors_for user_form end end |
#show ⇒ Object
28 29 30 |
# File 'app/controllers/tramway/api/v1/users_controller.rb', line 28 def show render json: current_tramway_user, status: :ok end |