pramodtech
pramodtech

Reputation: 6270

How to write multiline commands in rails console

I'm new to Rails and linux world. Question looks very simple but I'm having tough time writing some long commands in console. Say, I have to run some active record queries to see the results in console, below line works perfect

User.find(1)

But I can't type below query as last 3 characters simply gets truncated

Category.includes(:posts => [{:comments => :guest}, :tags]).find(1)

or something weird happens like below

nd(1)-p327 :009 > Category.includes(:posts => [{:comments => :guest}, :tags]).fin

What I need to do to get it work?

Upvotes: 2

Views: 6107

Answers (1)

d_ethier
d_ethier

Reputation: 3911

If you end a line with a period IRB will assume it is a multi-line command:

Category.
includes(:posts => [{:comments => :guest}, :tags]).
find(1)

It's odd that it's getting truncated though. Which terminal application are you using?

Upvotes: 5

Related Questions