I'm using the twitter gem found here: http://sferik.github.io/twitter/
I have some code that looks like:
#twitter_client.update(tweet_string, :in_reply_to_status_id => 402712877960019968)
Which generates the error:
./twitter.rb:68:in `update': wrong number of arguments (2 for 1) (ArgumentError)
However, I'm looking at the documentation here: https://github.com/sferik/twitter/blob/master/examples/Update.md
Which says:
client.update("I'm tweeting with #gem!", :in_reply_to_status_id => 402712877960019968)
When I remove the :in_reply_to_status_id, it works fine. I believe you can see the method here (Line 128): https://github.com/sferik/twitter/blob/0d23c5ed65a7e7728cd096d611e5edeecdbc6e79/lib/twitter/rest/tweets.rb
Any thoughts on what I'm doing wrong here?
I got it to work using the latest gem version and putting the in reply status in a hash:
client.update("I'm tweeting with #gem!", {:in_reply_to_status_id => 402712877960019968})
Give that a try and let me know if that works
Related
I am following the Padrino tutorial from here:
https://www.padrinorb.com/guides/blog-tutorial
I am copy and pasting the commands but I quickly ran into an error I don't understand:
$ padrino g controller posts get:index get:show
create app/controllers/posts.rb
create app/views/posts
apply tests/shoulda
/Users/waprin/.rvm/gems/ruby-2.1.0/gems/padrino-gen-0.12.4/lib/padrino-gen/generators/controller.rb:66:in `prepend': can't modify frozen String (RuntimeError)
from /Users/waprin/.rvm/gems/ruby-2.1.0/gems/padrino-gen-0.12.4/lib/padrino-gen/generators/controller.rb:66:in `create_controller'
This might be a bit late, but in case anyone else runs across this error (and because I just worked through the same tutorial) I'll post anyway...
It looks like there's an issue when generating controllers if a test component is specified. In this case you're using shoulda, but the same happens when using rspec and maybe others. It's been reported as a bug: https://github.com/padrino/padrino-framework/issues/1850 and has been fixed, but isn't yet part of a stable release.
One option to fix this would be to change your Gemfile to work with the latest from their github repo. To do this delete your GemFile.lock file, and comment out the line under 'Padrino Stable Gem' in your GemFile:
gem 'padrino', '0.12.4'
then uncomment the line under 'Or Padrino Edge':
gem 'padrino', :github => 'padrino/padrino-framework'
then re-run bundle install.
Of course, you'll no longer be running the stable release, and that may come with other trade-offs.
As a side-note, I believe that the guide on that page is fairly out of date. I also needed to replace:
get :index do
#posts = Post.all(:order => 'created_at desc')
render 'posts/index'
end
with:
get :index, :provides => [:html, :rss, :atom] do
#posts = Post.order('created_at desc')
render 'posts/index'
end
in the Post controller as the active record interface has changed since the time that the guide was written.
I was able to sole this problem by simply going to padrino gem path.
For me it was:
/Users/ahmadhassan/.rvm/gems/ruby-2.2.0/gems/padrino-gen-0.12.4/lib/padrino-gen/generators
open controller.rb and change line number 61:
path = #controller
to
path = #controller.dup
I am using the same code as found in the Mandrill documents:
http://help.mandrill.com/entries/23257181-Using-the-Mandrill-Ruby-Gem
I cut and paste and get the following error at this line:
m = Mandrill::API.new =>
ArgumentError: wrong number of arguments (0 for 1..2)
from /usr/local/lib/ruby/gems/2.1.0/gems/mandrill-0.0.4/lib/mandrill/api.rb:35:in `initialize'
But this is exactly as described in the official docs.
When I, on my own, pass a parameter for the environment variable as follows:
m = Mandrill::API.new(ENV['MANDRILL_APIKEY'])
I get a legitimate client. However, the next line fails:
sending = m.messages.send message
DEBUG -- : HTTPI POST request to mandrillapp.com (excon)
Mandrill::API::Error: (-99) Unknown method "..messages"
from /usr/local/lib/ruby/gems/2.1.0/gems/mandrill-0.0.4/lib/mandrill/api.rb:51:in `method_missing'
Seems like things aren't working. This set of code worked prior. But I'm not sure how to proceed.
It seems like you're not using the official gem called mandrill-api but rather a deprecated 3rd party gem called mandrill. Use the former and the problem should go away.
Everything was working fine in Rails 3.0.14, but after changing
gem 'rails', '3.0.14' to gem 'rails', '3.1.4' and running bundle update rails I now get the following error:
Started GET "/" for 127.0.0.1 at 2012-03-16 11:11:44 -0400
Processing by PagesController#index as HTML
Completed 500 Internal Server Error in 54ms
ArgumentError (wrong number of arguments (3 for 2)):
app/controllers/application_controller.rb:37:in `customize_by_subdomain'```
The most popular answer seemed to be that sqlite3 needed to be updated, but I did bundle update sqlite3 and I still have the same problem.
Here is the full trace: https://gist.github.com/2050530
The method that it is complaining about looks like this:
35 def customize_by_subdomain
36 subdomain = (request.subdomain.present? && request.subdomain != 'www' && request.subdomain) || 'launch'
37 #current_org = Organization.find_by_subdomain(subdomain) || Organization.find_by_subdomain('launch')
38 end
I have looked at the multitude of similar questions and I not found anything that solves my problem. The closest was question to mine was: wrong number of arguments (3 for 1) after upgrading rails from 3.1.1 to 3.1.3 but I am using authlogic and the version I am using didn't change after upgrading rails.
The only other interesting thing is my entire test suite passes, except for one request/integration spec which goes through the process of creating a new user. It seems strange that my request specs work fine when I can't even access a page in development.
Any ideas on what I can do to get to the bottom of this?
It looks like your New Relic plugin may need to be updated to a new version. In your stacktrace, the first line is from the New Relic code in your plugins folder. From their site, it looks like they released new Rails 3.1-specific code:
http://blog.newrelic.com/2011/07/29/for-the-active-record-new-relic-support-for-rails-3-1-is-here/
In the blog post, they talk about changes to the way ActiveRecord does logging, and your exception was triggered on the log_with_instrumentation method.
It looks like now you should install it as a gem rather than a plugin:
https://github.com/newrelic/rpm
Hope this helps.
I used to have the following call working just fine on a Rails app running Ruby 1.8.7:
HTTParty.post("my uri", :body => "some body", :headers => { "Content-type" => "text/xml"})
When I run the same line on Ruby 1.9.2 I'm getting a MultiXml::ParseError with this message:
"xmlns: URI xyz is not absolute"
The call to my uri works just fine when I use curl, and I get back the expected response, which looks something like this:
<client login="foo" numsessions="1" xmlns="xyz"/>
Any Insight?
After much struggle, I gave up on HTTParty for this. I tried Patron, which worked local, but didn't on Heroku, and I finally settled on RestClient, which worked great. https://github.com/archiloque/rest-client
That's because curl doesn't try to parse the xmlns. You could either try making sure you use the same version of httparty with 1.9.2 as you use with 1.8.7 or asking the people in charge of that uri to make the xmlns valid
I have the following settings
Rails.application.config.generators do |g|
g.test_framework :rspec,
:fixture => true
g.integration_tool :cucumber
g.fixture_replacement :factory_girl, :dir => "spec/factories"
end
And yet when I try to run:
rails g inherited_resources_controller gallery name:string publish_at:time
I get a:
error cucumber [not found]
However, I googled the issue and it seems a lot of people are using this setting without a problem.
Any ideas why it's not working for me? Using Rails 3.0.6 (just updated to 3.0.7) and the latest version of cucumber.
Thanks in advance,