title: Rails - Onelogin ruby-saml integration issue +
body: <p>I am facing issue in using ruby-saml in my Rails application. I am new to Ruby world.</p>
  
  <p>From <a href="https://stackoverflow.com/a/4233917/2041959">here</a> I got to know I could use <a href="https://github.com/onelogin/ruby-saml/blob/master/README.md" rel="nofollow noreferrer">ruby-saml</a> tool kit for SAML SP.</p>
  
  <p>Now, when I tried to refer to OneLogin in my controller (like below) I am getting the error "uninitialized constant Onelogin::Saml".</p>
  
  <pre><code>OneLogin::RubySaml::Authrequest.new
  </code></pre>
  
  <p>When I tried include below lines in my controller I am getting different errors.</p>
  
  <pre><code>require 'onelogin/saml'
  or
  require 'onelogin/ruby-saml'
  </code></pre>
  
  <p>Getting the errors like,</p>
  
  <pre><code>cannot load such file -- onelogin/saml
  or
  cannot load such file -- onelogin/ruby-saml
  </code></pre>
  
  <p>I installed the gem ruby-saml and I included the same in my rails application's GemFile as well and ran bundle install as well.</p>
  
  <pre><code>[root@localhost SP]# bundle show ruby-saml  
  /usr/local/rvm/gems/ruby-2.1.1/gems/ruby-saml-0.8.1  
  [root@localhost SP]# 
  </code></pre>
  
  <p>My controller:</p>
  
  <pre><code>#require 'onelogin/saml'
  
  require 'onelogin/ruby-saml'
  
  class SamlController &lt; ApplicationController
    skip_before_filter :verify_authenticity_token, :only =&gt; [:consume]  
  
    def index
      #settings = Account.get_saml_settings
      settings = :get_saml_settings
      request = Onelogin::Saml::Authrequest.new
      redirect_to(request.create(settings))
    end
  
    def consume
      response = Onelogin::Saml::Response.new(params[:SAMLResponse])
      response.settings = Account.get_saml_settings
  
      logger.info "NAMEID: #{response.name_id}"
  
      if response.is_valid?
        session[:userid] = response.name_id
        redirect_to :action =&gt; :complete
      else
        redirect_to :action =&gt; :fail
      end
    end
  
    def complete
    end
  
    def fail
    end
  
  def get_saml_settings
  end
  
  end
  </code></pre>
  
  <p>I am not sure what I am missing. Thoughts?</p>