DEV Community

Moiz Ali
Moiz Ali

Posted on

8 1

5 Surprising ways to use Rails console

While running on Rails, there's been hardly a day when you don't pull up rails console. Having basic mode and usage is fine but to spice up things a little bit I would like to share some tricks in this regard.

View Tables

Just run this command and get a glimpse of tables

Image description

Sandbox Mode

You can enable sandbox mode, so that commands are rolled back once you exit

Image description

Make HTTP Requests

Being lazy to hit a route through chrome or any other browser, just play with app object's methods!

Image description

Locate Method Source

Its a kindof search feature that a code editor also offers, but helpful one for the rubyists

Image description

Block Returned Output

If you're annoyed from the return value by iterators and other structures, this will let you cool down!

Image description

Does it worth time saving?. Let me know inside comments.
Make sure to Love and follow @moiz1524

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (5)

Collapse
 
w3ndo profile image
Patrick Wendo

Had no Idea you could make HTTP requests. That seems handy

Collapse
 
moiz1524 profile image
Moiz Ali

Yap! Quite a bit. But super useful when you try to inspect responses

Collapse
 
w3ndo profile image
Patrick Wendo

indeed. Supplements Postman

Thread Thread
 
moiz1524 profile image
Moiz Ali

Kind of. Just a lazy way to not use Postman

Collapse
 
moiz1524 profile image
Moiz Ali

Glad you liked it!

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →