Created
December 2, 2012 21:37
-
-
Save thebusiness11/4191176 to your computer and use it in GitHub Desktop.
Ajax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% @random_hashtags.each do |hashtag| %> | |
<div class="span4 twitter-spans-v1"> | |
<div id="tweet-block-v1" class="hashtag-tweet-database-container"> | |
<div class="tweet-block-border-v1"> | |
<div class="tweet-block-spacing-v1"> | |
<div class="twitter-block-author-v1"> | |
<a class="twitter-block-user-v1" target="_blank" href="https://twitter.com/<%= hashtag.from_user %>"> | |
<span class="twitter-author-image-v1"><img alt="" class="twitter-author-image-photo-v1" src="<%= hashtag.profile_image_url %>"></span> | |
<span class="twitter-author-name-v1"><%= hashtag.from_user_name %></span> | |
<span class="twitter-author-nickname-v1">@<%= hashtag.from_user %></span> | |
</a> | |
<iframe class="twitter-follow-button-v1" scrolling="no" frameborder="0" src="//platform.twitter.com/widgets/follow_button.html#align=right&button=grey&screen_name=<%= hashtag.from_user %>&show_count=false&show_screen_name=false&lang=en" allowtransparency="true"> | |
</iframe> | |
</div> | |
<div class="twitter-text-container-v1"> | |
<p class="twitter-text-field-v1"> | |
<%= hashtag.text %> | |
</p> | |
</div> | |
<div class="twitter-footer-v1"> | |
<a class="twitter-view-details-v1" target="_blank" href="https://twitter.com/<%= hashtag.from_user %>/statuses/<%= hashtag.tweet_id %>"> | |
<span class="tweet-date-v1"><%= hashtag.created_at.strftime("%d %b %Y") %></span> | |
</a> | |
<span class="twitter-vote-button-v1"><a href="#" class="btn btn-mini btn-primary">#WINNING</a> | |
</span> | |
<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> | |
<ul class="twitter-intent-ul-v1"> | |
<li class="twitter-intent-li-v1"><a href="https://twitter.com/intent/tweet?in_reply_to=<%= hashtag.tweet_id %>" class="twitter-intent-tweet" title="Reply"></a></li> | |
<li class="twitter-intent-li-v1"><a href="https://twitter.com/intent/retweet?tweet_id=<%= hashtag.tweet_id %>" class="twitter-intent-retweet" title="Retweet"></a></li> | |
<li class="twitter-intent-li-v1"><a href="https://twitter.com/intent/favorite?tweet_id=<%= hashtag.tweet_id %>" class="twitter-intent-favorite" title="Favorite"></a></li> | |
</ul> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(".live-votes").slideDown(2222).prepend("<%= escape_javascript(render(:partial => 'shared/vote_tweets', :object => @random_hashtags)) %>") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NoMethodError in Hashtags#create | |
Showing /Users/lancevelasco/Development/tweetvstweet/app/views/shared/_vote_tweets.html.erb where line #1 raised: | |
undefined method `each' for nil:NilClass | |
Extracted source (around line #1): | |
1: <% @random_hashtags.each do |hashtag| %> | |
2: <div class="span4 twitter-spans-v1"> | |
3: <div id="tweet-block-v1" class="hashtag-tweet-database-container"> | |
4: <div class="tweet-block-border-v1"> | |
Trace of template inclusion: app/views/hashtags/create.js.erb | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hashtag < ActiveRecord::Base | |
attr_accessible :text, :profile_image_url, :from_user, :created_at, :tweet_id, :hashtag, :from_user_name | |
def self.pull_hashtag(hashtag) | |
hashtag_scrubbed = hashtag | |
Twitter.search("%#{hashtag}", :lang => "en", :count => 100, :result_type => "mixed").results.map do |tweet| | |
unless exists?(tweet_id: tweet.id) | |
create!( | |
tweet_id: tweet.id, | |
text: tweet.text, | |
profile_image_url: tweet.user.profile_image_url, | |
from_user: tweet.from_user, | |
from_user_name: tweet.user.name, | |
created_at: tweet.created_at, | |
hashtag: hashtag | |
) | |
end | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment