Experiences on the Front Lines of User Interfaces and Web Development

Call controller action from script console in rails app

An easy way to call an action in script/console of your Ruby on Rails application is to simply call "app.get" and pass parameters similar to a functional test. You then can get access to the response object with "app.response".

> app.get '/posts/1'
> r = app.response
> r.body
> r.cookies

Comments

Call Controller
One thing I love with Ruby codes is that it is clean and simple. Nice call controller script and thanks for sharing.

comments powered by Disqus