Twitter gem 无法在推文中呈现链接。如何呈现 Twitter 链接以供查看?例如链接到@user 或链接到#tag
看法:
<% @tweet_news.each do |tweet| %>
<li><em><%= l tweet.created_at %></em>
<p><%= raw linkify(tweet.text) %></p>
<li>
<% end %>
控制器:
def news
account = Settings['twitter'][Locale.get.to_s]
Twitter.configure do |config|
config.consumer_key = account['consumer_key']
config.consumer_secret = account['consumer_secret']
config.oauth_token = account['oauth_token']
config.oauth_token_secret = account['oauth_token_secret']
end
@twitter_user = account['name']
@tweet_news = Twitter.user_timeline(@twitter_user, {count: 3})
render 'blocks/news', layout: false