Saturday 15 January 2011

ruby on rails - how to display all the social accounts which have connected user? -


How to display all the social accounts connected to a user? Is it possible to make performance easy?

These views:

  <% = twitter_profile (@user)%> & Lt;% = facebook_profile (@user)%> & Lt;% = joined_profile (@user)%> & Lt;% = google_profile (@user)%> & Lt;% = instagram_profile (@user)%>  

Helper:

  def twitter_profile (user) user.twitter_profile? Image_tag (user.twitter_profile.profile_picture_url): "Finally Diif Facebook_profile (user) user.facebook_profile? Image_tag (user.facebook_profile.profile_picture_url):" Finally Diif user.linkedin_profile Linkin_profail (user)? Image_tag (user.linkedin_profile.profile_picture_url): "end def google_profile (user) user.google_profile? Image_tag (user.google_profile.profile_picture_url):" Finally Diif user.instagram_profile instagram_profile (user)? Image_tag (user.instagram_profile.profile_picture_url): " 

if you want to try the Metaprografiking , use it in your database module:

 % w (Twitter Firefox linking Google Instagram) Do Kcote | network | # {network} _profile? Image_tag (user. # {network} _profile.profile_picture_url): '' end '} end  

Warg_yvl {{def # {network} _profile (user) Note: I readability and debugging Metaprogramming for Does not recommend using.


No comments:

Post a Comment