json.commits commits do |commit| json.title commit["title"] json.time time_from_now(commit["created_at"]) json.id commit["id"] user = git_username(commit["author_email"]) if user.present? json.author do if user json.partial! 'users/user', user: user end end else json.author do json.id nil json.login nil json.name commit["author_name"] json.email commit["author_email"] end end end