Hi there, I have a Rails application I developed using Rails 3.0.0.beta4. Up until now no views were needed. My controllers just rendered text and status (webservice). Now i needed my first UI, i upgraded to rails 3.0.0.rc and i am for the first time working with haml. When i go to my first view, i get this very weird error: wrong number of arguments (2 for 0) The full trace: activesupport (3.0.0.rc) lib/active_support/callbacks.rb:93:in `send'' activesupport (3.0.0.rc) lib/active_support/callbacks.rb:93:in `run_callbacks'' actionpack (3.0.0.rc) lib/abstract_controller/callbacks.rb:17:in `process_action'' actionpack (3.0.0.rc) lib/action_controller/metal/instrumentation.rb: 30:in `process_action'' activesupport (3.0.0.rc) lib/active_support/notifications.rb:52:in `instrument'' activesupport (3.0.0.rc) lib/active_support/notifications/ instrumenter.rb:21:in `instrument'' activesupport (3.0.0.rc) lib/active_support/notifications.rb:52:in `instrument'' actionpack (3.0.0.rc) lib/action_controller/metal/instrumentation.rb: 29:in `process_action'' actionpack (3.0.0.rc) lib/action_controller/metal/rescue.rb:17:in `process_action'' actionpack (3.0.0.rc) lib/abstract_controller/base.rb:105:in `process'' actionpack (3.0.0.rc) lib/abstract_controller/rendering.rb:40:in `process'' actionpack (3.0.0.rc) lib/action_controller/metal.rb:133:in `dispatch'' actionpack (3.0.0.rc) lib/action_controller/metal/rack_delegation.rb: 14:in `dispatch'' actionpack (3.0.0.rc) lib/action_controller/metal.rb:173:in `action'' actionpack (3.0.0.rc) lib/action_dispatch/routing/route_set.rb:62:in `call'' actionpack (3.0.0.rc) lib/action_dispatch/routing/route_set.rb:62:in `dispatch'' actionpack (3.0.0.rc) lib/action_dispatch/routing/route_set.rb:27:in `call'' rack-mount (0.6.9) lib/rack/mount/route_set.rb:148:in `call'' rack-mount (0.6.9) lib/rack/mount/code_generation.rb:89:in `recognize'' rack-mount (0.6.9) lib/rack/mount/code_generation.rb:80:in `optimized_each'' rack-mount (0.6.9) lib/rack/mount/code_generation.rb:88:in `recognize'' rack-mount (0.6.9) lib/rack/mount/route_set.rb:139:in `call'' actionpack (3.0.0.rc) lib/action_dispatch/routing/route_set.rb:489:in `call'' haml (3.0.14) lib/sass/plugin/rack.rb:41:in `call'' actionpack (3.0.0.rc) lib/action_dispatch/middleware/head.rb:14:in `call'' rack (1.2.1) lib/rack/methodoverride.rb:24:in `call'' actionpack (3.0.0.rc) lib/action_dispatch/middleware/params_parser.rb: 21:in `call'' actionpack (3.0.0.rc) lib/action_dispatch/middleware/flash.rb:177:in `call'' actionpack (3.0.0.rc) lib/action_dispatch/middleware/session/ abstract_store.rb:149:in `call'' actionpack (3.0.0.rc) lib/action_dispatch/middleware/cookies.rb:268:in `call'' activerecord (3.0.0.rc) lib/active_record/query_cache.rb:32:in `call'' activerecord (3.0.0.rc) lib/active_record/connection_adapters/abstract/ query_cache.rb:28:in `cache'' activerecord (3.0.0.rc) lib/active_record/query_cache.rb:12:in `cache'' activerecord (3.0.0.rc) lib/active_record/query_cache.rb:31:in `call'' actionpack (3.0.0.rc) lib/action_dispatch/middleware/callbacks.rb: 46:in `call'' activesupport (3.0.0.rc) lib/active_support/callbacks.rb:410:in `_run_call_callbacks'' actionpack (3.0.0.rc) lib/action_dispatch/middleware/callbacks.rb: 44:in `call'' rack (1.2.1) lib/rack/sendfile.rb:107:in `call'' actionpack (3.0.0.rc) lib/action_dispatch/middleware/remote_ip.rb: 48:in `call'' actionpack (3.0.0.rc) lib/action_dispatch/middleware/ show_exceptions.rb:48:in `call'' railties (3.0.0.rc) lib/rails/rack/logger.rb:13:in `call'' rack (1.2.1) lib/rack/runtime.rb:17:in `call'' activesupport (3.0.0.rc) lib/active_support/cache/strategy/ local_cache.rb:72:in `call'' rack (1.2.1) lib/rack/lock.rb:11:in `call'' rack (1.2.1) lib/rack/lock.rb:11:in `synchronize'' rack (1.2.1) lib/rack/lock.rb:11:in `call'' actionpack (3.0.0.rc) lib/action_dispatch/middleware/static.rb:30:in `call'' railties (3.0.0.rc) lib/rails/application.rb:168:in `call'' railties (3.0.0.rc) lib/rails/application.rb:77:in `send'' railties (3.0.0.rc) lib/rails/application.rb:77:in `method_missing'' railties (3.0.0.rc) lib/rails/rack/log_tailer.rb:15:in `call'' rack (1.2.1) lib/rack/content_length.rb:13:in `call'' rack (1.2.1) lib/rack/handler/webrick.rb:52:in `service'' /home/nva/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/ httpserver.rb:104:in `service'' /home/nva/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/ httpserver.rb:65:in `run'' /home/nva/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb: 173:in `start_thread'' /home/nva/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb: 162:in `start'' /home/nva/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb: 162:in `start_thread'' /home/nva/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb: 95:in `start'' /home/nva/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb: 92:in `each'' /home/nva/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb: 92:in `start'' /home/nva/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb: 23:in `start'' /home/nva/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb: 82:in `start'' rack (1.2.1) lib/rack/handler/webrick.rb:13:in `run'' rack (1.2.1) lib/rack/server.rb:213:in `start'' railties (3.0.0.rc) lib/rails/commands/server.rb:65:in `start'' railties (3.0.0.rc) lib/rails/commands.rb:30 railties (3.0.0.rc) lib/rails/commands.rb:27:in `tap'' railties (3.0.0.rc) lib/rails/commands.rb:27 script/rails:6:in `require'' script/rails:6 I have got no clue what this means or what i am doing wrong. I have found a few things i need to change when going from beta4 to rc but i still can''t explain this. It goes wrong in the callbacks, in the following function: def run_callbacks(kind, *args, &block) send("_run_#{kind}_callbacks", *args, &block) end i have no idea why. I hope someone can shed some light ... -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, Jul 27, 2010 at 11:48, nathanvda <nathanvda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> When i go to my first view, i get this very weird error: > > wrong number of arguments (2 for 0)That means you''re calling some function/method that''s expecting no arguments, and you''re giving it two.> It goes wrong in the callbacks, in the following function: > > def run_callbacks(kind, *args, &block) > send("_run_#{kind}_callbacks", *args, &block) > endMy guess would be that the callback is expecting no args, but is being sent *args and &block. Even if it ignores them, it should probably accept them. Try that and see if it works.... -Dave -- Specialization is for insects. -RAH | Have Pun, Will Babble! -me Programming Blog: http://codosaur.us | Work: http://davearonson.com Leadership Blog: http://dare2xl.com | Play: http://davearonson.net -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Well, from the log as far as i could tell: it was no where in MY code, but everything in rails code. So it seemed there was no easy way for me to interfere easily. But luckily, as is often the case, the problem/bug was a stupid mistake. My class is called EnvelopesController, and what did i want to do with my envelopes? send them! Alas, defining a such-named method will cause terrible havoc! :D Stupid-stupid-stupid :) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Wed, Jul 28, 2010 at 02:17, nathanvda <nathanvda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> But luckily, as is often the case, the problem/bug was a stupid > mistake. > > My class is called EnvelopesController, and what did i want to do with > my envelopes? send them! > Alas, defining a such-named method will cause terrible havoc! :DThat''s the sort of thing that seems to strike Rails devs all the time. Happened to me when I named something "options" IIRC. It seems similar to someone''s dictum on gun handling: there are shooters who have had accidental discharges, and shooters who *will*. :-) Perhaps there ought to be a gem/plugin/whatever that will warn you if it detects reuse of a word that Rails uses.... -Dave -- Specialization is for insects. -RAH | Have Pun, Will Babble! -me Programming Blog: http://codosaur.us | Work: http://davearonson.com Leadership Blog: http://dare2xl.com | Play: http://davearonson.net -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.