Search code examples
ruby-on-railsrubytumblr

Rails: tumblr_client gem works in console, not in app


I'm new to Rails and have been writing a simple app to post to Tumblr. I got all my oauth stuff working, and decided to use the tumblr_client gem to facilitate posting. I can get it to post just fine through the console, but the same code does not do anything in the controller. It doesn't throw any errors, it just does nothing. Any suggestions? (I censored the blog with {blogname}, but it is correct in my code)

def post
  @user = Tumblog.find_by_user_id(5)
  @client = Tumblr::Client.new(:consumer_key => @key, :consumer_secret => @secret, :oauth_token => @user.oauth_token, :oauth_token_secret => @user.oauth_secret)
  @client.text("{blogname}.tumblr.com", :body => "test", :state => "draft")
  redirect_to "http://www.tumblr.com/blog/{blogname}/drafts"
end

Solution

  • It turns out that it was a conflict with my instance variable name. Changed @client to @clients and it worked just fine.