* Refactoring to add helper method Prior to this commit, we made view level calls to service modules. This refactor provides convenience methods on the model. Furthermore, it addresses a few Rubocop violations that "come along for the ride." * Ensuring cached entity squaks like User * Fixing broken spec * Fixing typo
17 lines
325 B
Ruby
17 lines
325 B
Ruby
json.type_of "user"
|
|
|
|
json.extract!(
|
|
user,
|
|
:id,
|
|
:username,
|
|
:name,
|
|
:twitter_username,
|
|
:github_username,
|
|
)
|
|
|
|
Profile.static_fields.each do |attr|
|
|
json.set! attr, user.profile.public_send(attr)
|
|
end
|
|
|
|
json.joined_at I18n.l(user.created_at, format: :json)
|
|
json.profile_image user.profile_image_url_for(length: 320)
|