If, as you’re working on Omnicalc, you are running in to a very confusing issue:
You have made changes to your code in calculations_controller.rb in Atom, (auto)saved it, gone back to Chrome, and refreshed — but nothing happens!
Then read on.
As I mentioned in class, this quarter we were trying something new with the interactive Ruby console appearing within Chrome.
My hope was that it would be helpful for you to be able to, for example, start experimenting with @text.length, @text.split, etc, in the word_count task in the web console before having to write down permanent Ruby in calculations_controller.rb.
However, we’ve discovered that the web console is somehow intermittently breaking the live reloading feature of Rails, which allows us to make changes to our code and see them live without having to restart the rails server every time.
This isn’t happening for everyone, nor for every code change, but when it does happen it is very confusing, especially for beginners. I apologize for that.
If you notice this happening, you can quit your rails server with Ctrl+C and then start it back up. You will then see the effect of your code change. This is, obviously, a pain, if you have to do it for every code change.
You can remove the web console altogether:
-
In the file
app/views/layouts/application.html.erb, delete the three lines near the bottom that say<% if Rails.env.development? %> <% console %> <% end %> -
In the
Gemfile, which is in the root folder ofomnicalc/, find line 42 which saysgem 'web-console'. Delete that line. -
Shut down your rails server with Ctrl+C.
-
Run
bundle installagain. -
Start up the
rails serveragain.
Hopefully all of this should resolve the issue, and any time you make a change to your code in Atom and save it, the change should be reflected when you refresh Chrome. If not, please let me know.
If you remove the web console but still want a console to play with, you can use the regular Rails Console, like we have always done in the past. This won't be quite as handy since you won't have the variables from calculations_controller.rb available for you to play with, but it's otherwise the same. Here is a guide to doing so.
Sorry for the confusion!