Module: Api::V1::ModelHash
- Included in:
- BaseController
- Defined in:
- lib/generators/happy_seed/api/templates/app/controllers/api/v1/model_hash.rb
Instance Method Summary collapse
Instance Method Details
#user_hash(user) ⇒ Object
2 3 4 5 6 7 |
# File 'lib/generators/happy_seed/api/templates/app/controllers/api/v1/model_hash.rb', line 2 def user_hash(user) { id: user.id, email: user.email } end |
#user_token_hash(user_token, *args) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/generators/happy_seed/api/templates/app/controllers/api/v1/model_hash.rb', line 9 def user_token_hash(user_token, *args) = args. output = { access_token: user_token.access_token } output.update(user: user_hash(user_token.user)) if true == [:user] output end |