When I type large ActiveRecord queries,Before finishing the query, the line is breaking and I can't even reading or typing the command properly.I am using ubuntu.Any solution?
Finally narrowed the issue to be with resizing the terminal.Usually I maximize the terminal for typing large commands , hence the problem. Found out that this can be solved by handling the SIGWINCH signal to resize IRB.In the solution below i am also resizing Hirb.
Add the following lines to ~/.irbrc (create one if it doesn't exist) :
Signal.trap('SIGWINCH', proc { y, x = `stty size`.split.map(&:to_i); Hirb::View.resize(x, y) if defined? Hirb } )
A more generic way is using a \
at the end of your line.
Using the same example of "Kenny Grant"
ruby> User.very.long.chain.of.arel.commands. \
where('thing = ?', 4).very.long.chain.of.arel.commands
the last line should not have any ending \
and then the whole command will be executed.
I've noticed the same bug with irb, rails console uses irb by default. That's why I'm using pry, look here how to setup pry with rails.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With