Skip to content

Instantly share code, notes, and snippets.

@antonrogov
Created October 13, 2009 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antonrogov/209167 to your computer and use it in GitHub Desktop.
Save antonrogov/209167 to your computer and use it in GitHub Desktop.
# in the view
<% unless current_user.fan?(params[:fb_sig_app_id]) %>
<div style="width: 117px; height: 25px; margin-right: 10px; margin-bottom: 20px; float: right; overflow: hidden; position: relative;">
<div style="position: absolute; top: -31px; left: -60px;">
<fb:fan profile_id="<%= params[:fb_sig_app_id] %>" stream="1" connections="10" width="300"></fb:fan>
</div>
</div>
<% end %>
# in the model
class AppKeys
def fan?(page_id = nil)
Rails.cache.fetch "#{self.class}:#{sn_user_id}:is_fan_of:#{page_id}", :expires_in => 15.minutes do
Facebooker::Page.new(page_id.to_i).user_is_fan?(sn_user_id)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment