Rails gotchas (reserved attribute or method name)
Some time ago I’ve got a really strange error message when trying to access a new method in a controller I have created for a rails application …
In the log the error message was:
“wrong number of arguments (2 for 0)”
the step by step to reproduce this error is:
- rails test
- cd test
- script/generate controller test process
- script/server
- point your browser to http://localhost:3000/test/process
What really happened?
ActionController has a method named process, and my controller:
class TestController < ApplicationController def process end end
defined a action with the same name, and it messed up with ActionPack …
Hasan had a very similar problem but with a reserved attribute of ActiveRecord
So, if you are having strange problems like these ones, try looking for a “reserved” attribute or method …
They are not really reserved, but, you have to pay attention when you redefine a “rails core” method ![]()
Even if you do not know that you are redefining the method ![]()
If you enjoyed this post, make sure you subscribe to my RSS feed!





thanks for writing.
i already faced “process” related problem :), anyway, i think, rails should give a warning message if something is messing up with reserved words.
though it is not possible with action pack (anyone can override any methods), but i believe it is possible with active record, where every attribute are accessed over method_mission.
best wishes