Instagram gem with Rails

I use Instagram gem for my favorite person's birthday Rails project:

Here's how I done it:-

Step 1

Register here

Step 2

Inside Gemfile;

        gem 'sqlite3'
        gem 'instagram'

Step 3

Inside your Rails app directory; $ bundle install

Step 4

Copy your client id from and paste it here for your access token.

Step 5

Create instagram.rb in config/initializers

        require "instagram"

        Instagram.configure do |config|

        config.client_id = "client_id goes here"

        config.access_token = "access_token goes here"


Step 6

$ rails g controller Home index

Step 7

Inside /app/controllers/home_controller.rb;

        class HomeController < ApplicationController

        def index
            @instagram = Instagram.user_recent_media("user_id_here", {:count => 1})


Get your user_id here

Step 8

Inside app/views/home/index.html.erb;

        <% @instagram.each do |instagram| %>

        <%= image_tag instagram.images.standard_resolution.url %>

        <% end %>

Step 9

Inside config/routes.rb, remove;

            get "home/index"

and replace with;

            root :to => "home#index"

Step 10

Remove index.html

         $ rm public/index.html