title: Rails Twitter Gem Omniauth
body: <p>I'm having trouble using omniauth &amp; twitter gem to generate tweets.  </p>
  
  <p>I have been using this tutorial <a href="http://blog.assimov.net/post/2358661274/twitter-integration-with-omniauth-and-devise-on-rails-3" rel="nofollow">http://blog.assimov.net/post/2358661274/twitter-integration-with-omniauth-and-devise-on-rails-3</a></p>
  
  <p>and I can log in using twitter, generate authentications but I cannot update tweets.</p>
  
  <pre><code>current_user.twitter.update("My Rails 3 App with Omniauth, Devise and Twitter")
  </code></pre>
  
  <p>This line complains about the method update.</p>
  
  <p>What confuses me about the tutorial above is that at the beginning they generate a migration to store the secret in authentications, but at no point later in the tutorial is any mention of changing any code to write the secret to the database.</p>
  
  <p>My understanding is that the secret is obtained from the omniauth hash that is stored in the session cookie.  What am I missing here?</p>
  
  <pre><code>def hash_from_omniauth(omniauth)
    {
        :provider =&gt; omniauth['provider'],
        :uid =&gt; omniauth['uid'],
        :token =&gt; (omniauth['credentials']['token'] rescue nil),
        :secret =&gt; (omniauth['credentials']['secret'] rescue nil)
    }
  end
  </code></pre>
  
  <p>So everything seems to be working apart from creating the Twitter Client hence not having the update method available?</p>
  
  <pre><code>current_user.twitter.update("first tweet")
  </code></pre>
  
  <p>The twitter method here should be creating the Twitter Client </p>
  
  <pre><code>  def twitter
  debugger
  unless @twitter_user
    provider = self.authentications.find_by_provider('twitter')
    @twitter_user = Twitter::Client.new(:oauth_token =&gt; provider.token, :oauth_token_secret =&gt; provider.secret )rescue nil
  end
  @twitter_user
  </code></pre>
  
  <p>end</p>
  
  <p>I'm sorry I'm not great at explaining the problem.  Any help greatly appreciated.
  Thanks
  L</p>