Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails: issuing POST and other http requests from the rails console?

Might be a dumb question, but is there a way to issue http requests directly from the rails console? Those that are POST / GET / PUT / DELETE? Without doing all the routing first?

like image 763
Alexander Savin Avatar asked Apr 20 '11 04:04

Alexander Savin


1 Answers

You can use app.get and friends:

app.get app.auctions_path # 200
app.post app.auctions_path # 200

The app variable maps to a ActionDispatch::Integration::Session so all its methods are available to you, including routes.

like image 103
icecream Avatar answered Nov 07 '22 19:11

icecream