the interactive, command-line interface to the Ruby-based Rails framework. The Rails console allows developers to interact directly with their application without using a browser.
Questions tagged [rails-console]
441 questions
5
votes
1 answer
Ruby Readline crashes console on up arrow
When I press the up or left arrow in the Rails console I get this bug:
irb(main):001:0> /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/rb-readline-0.4.2/lib/rbreadline.rb:4269:in `block in _rl_dispatch_subseq': invalid byte sequence in UTF-8…

Ben G
- 26,091
- 34
- 103
- 170
5
votes
1 answer
Postgresql table values don't match Ruby on Rails Active Record query results
I have a table named monthly_trips in Postgresql. There is a row with values id = 3 & al = 107.415. My problem is when I try to access the value of the "al" column in rails. Using the Rails Console with the code below I get the result of …

Ferrari692
- 101
- 5
5
votes
1 answer
Rails deprecation warning for vendor/plugins when I don't have any
Possible Duplicate:
eliminating Rails 2.3-style plugins and deprecation warnings
I get the following error when I do a heroku run console:
$ heroku run console
Running `console` attached to terminal... up, run.1
DEPRECATION WARNING: You have…

at.
- 50,922
- 104
- 292
- 461
4
votes
2 answers
How do I prevent Rails Console from performing an immediate rollback on db transaction?
I'm new to rails and I'm having some trouble in the console. I'd like to add records to my Users table and test some functions. However, everytime i perform a User.create or similar function, it completes successfully and then immediately gets…

Derek Harrington
- 457
- 4
- 13
4
votes
3 answers
Rails console limits text output. How do I get to see it all?
It seems like the Rails console limits its character output to about 880 characters.
How do I remove this limitation?
Printing large objects, or text fields from the database, gives output like this:
=> #

Magne
- 16,401
- 10
- 68
- 88
4
votes
1 answer
How to update test database in Rails 3?
I added an entry to the yml fixture for a model. Then rails console test. But the new record is not in the database.
How do you "update" the test database to access it in rails console?
Working in Rails 3.0.7, using built-in unit test.
Thanks.

B Seven
- 44,484
- 66
- 240
- 385
4
votes
3 answers
Rails console: Does rails console maintain cache for database tables? How to disable that?
I got fk parent/child row deletion/update errors while performing deletion on parent row.So I removed related child records from database manually. But still i am getting errors. I presume it is related to cache. One more thing i must mention here…

Maddy.Shik
- 6,609
- 18
- 69
- 98
4
votes
1 answer
rails 5: rails c doesn't show line number on error
I'm running rails 5, upgraded from 4.2.x
In the console and when running methods that fail, the error
doesn't show the line number, I only get to see:
Traceback (most recent call last):
NoMethodError (undefined method `[]' for nil:NilClass)
I made…

JUlinder
- 995
- 1
- 8
- 19
4
votes
2 answers
Unable to connect to database from rails console on dockers
I have my rails project setup on Digitalocean using Dockers. This is my docker-compose.prod.yml file.
version: "2"
volumes:
db-data:
external: false
services:
db:
image: postgres
env_file: .env.production
volumes:
-…

Rails Developer
- 402
- 6
- 18
4
votes
3 answers
How Do I Correct An Error with rails console command?
When I'm in the root directory of my Rails app I can successfully execute rails server. However when I try to do rails console or rails c I get the following error.
[myrailsapp (master)]$ rails…

Pamela Cook - LightBe Corp
- 3,912
- 5
- 50
- 86
4
votes
1 answer
set rails console stack backtrace limit permanently
rails console by default boots with context.back_trace_limit=16, which can be changed to whatever you want simply by typing context.back_trace_limit=n. The problem is you have to type it each time you boot rails c. Where do I change the…

medik
- 1,174
- 12
- 17
4
votes
1 answer
Colors in irb / rails console
I'm testing a gem that outputs color in the terminal:
module Color
def self.colorize(text, color_code)
"#{color_code}#{text}e[0m"
end
def self.red(text)
self.colorize(text, "\033[1;31;12m")
end
end
I have a testing…

Starkers
- 10,273
- 21
- 95
- 158
4
votes
2 answers
Copy between databases in Rails console
I have three databases:
A. mynewapp_psql (Postgres)
B. old_products_psql (Postgres)
C. old_blogposts_mysql (Mysql)
Each is defined in database.yml
I'm using A (mynewapp_psql) as the database for my new app. In this app I want to be able to copy…

Christoffer
- 2,271
- 3
- 26
- 57
4
votes
2 answers
Why doesn't Awesome Print work on some Rails collection objects?
Awesome Print generally works perfectly for me in Rails.
But when doing ap Post.all in the Rails console I only get the standard full line output.
Has it to do with the returned ActiveRecord_Relation class or something else, because when an array…

Fellow Stranger
- 32,129
- 35
- 168
- 232
4
votes
1 answer
Can I define alias in Rails console
I tried to edit my ~/.irbrc file
and define show_tbls method to fetch the tables I have,
because the command is to long , so I tried to make a function for easier use.
require 'hirb' ; Hirb.enable
require 'irb/completion'
def show_tbls
…

newBike
- 14,385
- 29
- 109
- 192