It's a brand new project. Here's the exact commands I've run:
rails new MyProject
bundle install
rails generate controller Image
I've added this one route:
root :to => "image#process"
I've added this function to the ImageController
(image_controller.rb
)
def process
render :nothing => true
end
And finally I've removed the default index.html
. When I run the project, it has an error saying process expects 0 parameters, not 1. So I modify the method to tell me what parameter is trying to be sent to process.
def process(arg)
p arg
render :nothing => true
end
The string "process" is printed to the screen. I've done several Rails projects before and never encountered this. Did I miss a step somewhere? Is this something new in Rails 3.0.10? Or maybe caused by Ruby 1.9.2? I think I usually use 1.8.7.
You can not name an action as process, this is an internal method for rails controllers, name it something else.
There's a bunch of other names you can't use for controller actions like render, params, request. Unfortunately there isn't a list of these things.
For future reference, in case you aren't using it, you can view all internal methods and classes here: ruby doc with nav on top right
Helps me when picking names.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With