Silly question about console and controllers

Jonathan :

I want to launch some controller methods in application.rb
from a script, so I'm trying to use the console to help write it.

?> require "app/controllers/application.rb"
=> true

you don't have to require it in script/console.

>> ApplicationController.post_render(:id => 119)
NoMethodError: undefined method `post_render' for
ApplicationController:Class
        from (irb):5

>> ApplicationController.instance_methods
=> ["methods", "web_service_object",
"render_nothing".........................."post_render",
............................. "gem", "transition", "silence_stream"]

What really silly thing am I doing wrong?

#post_render is an instance method and you're invoking it
as a class method, so it doesn't work :slight_smile:

If you want to test your action in script/console, call it
as if it were a browser :

app.get 'my_url'

(like app.get 'article/show/2' )

and inspect it :

app.response.body
app.controller.params
...

   -- Jean-François.