As a Rails newbie, trying to wrap my head around JQuery (the new default on Rails 3.1) has been a bit of a chore.  This isn't because it's hard to use, or because the RailsTutorial.org is hard to follow.  Actually, the opposite is true: because it's so easy to use, that means it is harder (for me) to figure out what is going wrong if (aka "when") something does go wrong.

Take, for instance, my latest trials with the RailsTutorial.  It should have been easy enough to type in exactly what we were told.  Except that this didn't work!  And, where do errors go if you're using a JavaScript button?

Enter FireBug.  It's not entirely intuitive, but at least it gives some pointers and displays the error messages that would otherwise fail to be displayed.  At first, I thought FireBug would just start spitting out the error messages, but I needed to configure it first.  Again, it wasn't much, but it did take me an hour of searching the web to just give up and try poking around.  The "Console" button was what I wanted.  Displayed nice error messages so that I could track down the bugs.  (Not that they're all fixed yet, but at least I have a direction to look!)

Very valuable!  Thanks so much.

By the way, if you're developing in Rails 3.1, you should be told that the JavaScript code might be running twice if you have assets:precompile as a setting.  (In development mode, it runs once as the raw code, and once as the compiled code.)   To fix this, in your config/environments/development.rb file, put config.serve_static_assets = false and then you're stuck with the precompiled assets only.  I found that answer here.  Thanks, StackOverflow!
 


Comments


Your comment will be posted after it is approved.


Leave a Reply