現在、facebookのログインはうまくいっており、プロフィール画像も取得できております。
しかし、name
の取得だけが普通の名前ではなく、羅列文字で4f427j700ef46f2555e6
と表示されます。
取得方法は
Ruby
1def self.from_omniauth(auth) 2 where(provider: auth.provider, uid: auth.uid).first_or_create do |user| 3 user.provider = auth.provider 4 user.email = auth.info.email 5 user.password = Devise.friendly_token[0,20] 6 user.name = auth.info.name # assuming the user model has a name 7 user.avatar = auth.info.image # assuming the user model has an image 8 # If you are using confirmable and the provider(s) you use validate emails, 9 # uncomment the line below to skip the confirmation emails. 10 # user.skip_confirmation! 11 end 12 end
です。
表示方法は、
Ruby
1<h2><%= @user.name %></h2>
です。
なぜ、名前を取得することができないのでしょうか?
教えてください。
あなたの回答
tips
プレビュー