What do the output colors in the rails console and the Rails server log mean?

I am running rails server and rails console on Ubuntu 14.04 inside a common terminal (the application is simply called "Terminal").

Whenever I run commands that are related to the database, the console issues a SQL query, but sometimes the text is turquoise and sometimes purple. For example, on this console output:

 2.2.2 :025 > pl = ProjectLevel.find_by(name: 'Premium') ProjectLevel Load (0.5ms) SELECT "project_levels".* FROM "project_levels" WHERE "project_levels"."deleted_at" IS NULL AND "project_levels"."name" = $1 LIMIT 1 [["name", "Premium"]] => #<ProjectLevel id: 1, name: "Premium", deleted_at: nil, created_at: "2015-07-15 15:45:40", updated_at: "2015-07-15 15:45:40"> 

(The colors displayed here do not match my console)

The part that says ProjectLevel Load (0.5ms) will sometimes be turqoise, but sometimes it will be purple, but every other part of the text. Does this color really mean something? Does this tell me something about the success of the request or the returned data? Usually, such things in Rails are pretty intuitive (for example, when a test suite returns green text or red text to tell you if the tests were successful), but I cannot find anything about where these colors come from

+7
ruby sql ruby-on-rails ubuntu rails-console
source share
1 answer

In Rails 5, colors indicate the type of request:

  • Blue for choice

    enter image description here

  • Yellow for updates

    enter image description here

  • Green for inserts

    enter image description here

  • Red to remove

    enter image description here

In addition to various other colors for things like alter table or begin / commit .


Prior to Rails 5, colors mean nothing. They simply alternate back and forth, so you can easily determine where one request stops and the next request begins.

10.times { Photo.all } gives:

enter image description here

+11
source share

All Articles