Method: Writefully::Authorship.create_from_data

Defined in:
app/models/writefully/authorship.rb

.create_from_data(auth_user) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'app/models/writefully/authorship.rb', line 24

def self.create_from_data(auth_user)
  create! do |authorship|
    authorship.data = { email: auth_user.email,
                        uid: auth_user.id,
                        user_name: auth_user.,
                        name: auth_user.name,
                        avatar: auth_user.avatar_url }.select { |k,v| v.present? }
                        
    authorship.role = authorship.select_role
  end 
end