# Problems with rails3.0.0.rc and haml?

**URL:** <https://www.ruby-forum.com/t/problems-with-rails3-0-0-rc-and-haml/192285>\
**Category:** Rails\
**Created:** [July 27, 2010, 6:35pm UTC](https://www.ruby-forum.com/t/problems-with-rails3-0-0-rc-and-haml/192285 "2010-07-27T18:35:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nathanvda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/57b2e6/32.png) [@nathanvda](https://www.ruby-forum.com/u/nathanvda)\
**Post date:** [July 27, 2010, 6:35pm UTC](https://www.ruby-forum.com/t/problems-with-rails3-0-0-rc-and-haml/192285/1 "2010-07-27T18:35:13Z")

</div>

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 …

---

<div class="post-metadata">

**Author:** ![nathanvda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/57b2e6/32.png) [@nathanvda](https://www.ruby-forum.com/u/nathanvda)\
**Post date:** [July 27, 2010, 7:07pm UTC](https://www.ruby-forum.com/t/problems-with-rails3-0-0-rc-and-haml/192285/2 "2010-07-27T19:07:26Z")

</div>

On Tue, Jul 27, 2010 at 11:48, nathanvda [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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)  
> end

My 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](http://codosaur.us) | Work: [http://davearonson.com](http://davearonson.com)  
Leadership Blog: [http://dare2xl.com](http://dare2xl.com) | Play: [http://davearonson.net](http://davearonson.net)

---

<div class="post-metadata">

**Author:** ![nathanvda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/57b2e6/32.png) [@nathanvda](https://www.ruby-forum.com/u/nathanvda)\
**Post date:** [July 28, 2010, 8:18am UTC](https://www.ruby-forum.com/t/problems-with-rails3-0-0-rc-and-haml/192285/3 "2010-07-28T08:18:17Z")

</div>

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! 😃

Stupid-stupid-stupid 🙂

---

<div class="post-metadata">

**Author:** ![nathanvda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/57b2e6/32.png) [@nathanvda](https://www.ruby-forum.com/u/nathanvda)\
**Post date:** [July 28, 2010, 7:18pm UTC](https://www.ruby-forum.com/t/problems-with-rails3-0-0-rc-and-haml/192285/4 "2010-07-28T19:18:08Z")

</div>

On Wed, Jul 28, 2010 at 02:17, nathanvda [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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! 😃

That’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](http://codosaur.us) | Work: [http://davearonson.com](http://davearonson.com)  
Leadership Blog: [http://dare2xl.com](http://dare2xl.com) | Play: [http://davearonson.net](http://davearonson.net)
