I'm running rails server
and rails console
in Ubuntu 14.04 inside the generic terminal (app is just called "Terminal").
Whenever I run commands that involve the database, the console outputs which SQL query it sent but sometimes the text a turquoise color and sometimes it's a purple color. For example in 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 that show up on here are not the same as my console)
The part that says ProjectLevel Load (0.5ms)
will sometimes be turqoise but will sometimes be purple but every other part of the text is. Does this color actually mean anything? Is it telling me something about the success of the query or the data returned? Usually things like this in Rails are pretty intuitive (like when a test suite returns green text vs red text to tell you if the tests were successful) but I can't seem to find anything about where those colors are coming from
In Rails 5, the colors indicate the type of query:
Blue for selects
Yellow for updates
Green for inserts
Red for deletes
In addition to various other colors for things like alter table
or begin
/commit
statements.
Prior to Rails 5, the colors don't mean anything. They just alternate back and forth so you can easily tell where one query stops and the next query begins.
10.times { Photo.all }
yields:
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