1.安装宝石“Instagram”
2.config / initializers / instagram.rb
Instagram.configure do |config|
config.client_id = "XXXXXXXXXXXXXXXXXXXXXXXXXX"
config.client_secret = "XXXXXXXXXXXXXXXXXXXXXXX"
config.access_token = "XXXXXXXXXXXXXXXXXXXXXXxXX"
end
3。在application_controller.rb中:( app / controllers /)
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
def index
@instagram = ::Instagram.user_recent_media('xxxxx', {:count => 15})
end
end
4。在视图中:(home / index.html.haml)
<% @instagram.each do |instagram| %>
<%= image_tag instagram.images.standard_resolution.url %>
<% end %>
任何人都可以帮我吗?我是红宝石的新手。