Javascript Debugger -- how to use with local Rails?

In the "What's New", the Javascript Debugger is mentioned.

It is very difficult to find any documentation on how to set it up and use it with a Ruby project. In the documentation, it describes how to setup a debugging environment for Javascript. This doesn't work well with a Rails app.

The options are

  1. Static HTML file that is part of the project (won't allow for .html.erb files). Forcing it to be an erb file was the only way I saw to get the Firebug plugin installed. But it opens the file directly into the browser which obviously won't work because the embedded Ruby isn't executed.
  2. Remote URL (fully qualified URL)


I'm wanting to debug a Cucumber/Capybara test that has a failing javascript call (that works fine for me in my browser). There doens't seem to be any way to use built-in javascript debugging for this. The URL is different everytime because of the changing port number. The static HTML file thing won't work since it isn't an HTML file and can't be loaded independent of the application. I can't test in Firebug because the browser is in "WebDriver" mode and doesn't have addons available even if I set a breakpoint in a controller to pause the browser.

Is there something I'm missing? Is there a way to use the Javascript Debugger for this?

Thanks,
-Mark E.

Message was edited by: Mark E - Updated information on Firefox in WebDriver mode.

5 comments
Comment actions Permalink

Hi Mark,

I understand and agree with your frustrations. I have seen RubyMine tout their new "Javascript debugging capability", but, like you, I couldn't find anything that told me how to actually set the thing up and use it. I'm using HAML, so the IDE does not allow me to set up a Run/Debug configuration. And even if it did, would I just be able to specify my home page, set some breakpoints, and have at it? Beats me.

So, Rubymine people - you didn't respond to Mark's post on this. Can you please respond to my reply? At least tell us how we can use the darn thing.

Thanks,
Larry

0
Comment actions Permalink

Hi,

Mark asked his question several months ago; I asked a followup over 3 months ago and no one has answered the questions. I was under the impression that Rubymine people monitored this forum - do you or don't you? If you don't and we have a question, how are we suppoosed to ask it - by emailing support?

Anyway, I still don't understand how to do Javascript debugging in a rails project. It seems like setting a breakpoint on a line in a JS file should work - but it doesn't. (Even though I get the red dot telling me that a breakpoint has been set - which feedback-wise says to me that I should break on that line when I run my program. If that's not the case, then don't give me the red-dot feedback!)

Also, when I try to add a 'Javascript Debug' configuration to the Run/Debug options the only thing I can select for the  HTML file field is a (surprise, surprise) HTML file. What good is this when most, if not all, of use are using ERB or HAML?

The doc is useless in this matter, so can someone from Rubymine please explain how we can debug JS files?

Thank you,
Larry

0
Comment actions Permalink

Larry, please take a look at attached screenshot:
Screen Shot 2011-07-29 at 2.43.21 PM.png
This will start JavaScript Debugger together with your Rails debug session. You can put breakpoints in your javascripts in public directory, mapping is created automatically. If you're using Rails 3.1, however, you should go to Scripts tab of JavaScript Debugger session and select required script there, because Rails 3.1 uses Sprockets to merge all scripts in application.js

0
Comment actions Permalink

Hi Dennis,

Thanks for the reply. Can I suggest that someone address this in the online documentation? Here is why: When you incorporated this feature into your product you just provided a blurb about it on your website. That means if we want to use it we have to fire up the online help to see how.

The problem is that many will go to the "Run/Debug Configuration: JavasScript Debug" section because that's what we want to accomplish. However, there is no mention of what you told me in that section. The information you provided is buried in a table in the "Run/Debug Configuration: Rails" section - a place I did not look - and even if I did, I could have easily missed the one entry in the table.

There are a TON (I believe too many) options for this product. You guys built it, so it is probably obvious to you how to do things or where to look for them. For us it's not so easy, especially the "where to find it" part.

Thanks,
Larry

P.S. On the BIG PLUS SIDE: I just used it and it is waaaaaay cool - thanks!!!

0
Comment actions Permalink

Hello again Dennis,

I recently switched my project over to Rails 3.1 and am using v4 (112.219) of RubyMine. Just wanted to say "Thanks!" for including instructions on using the JavaScript debugger with Rails 3.1. When I first tried I didn't understand what the heck was going on, but then I searched this forum and found your prescient comments on how-to-use the debugger in Rails 3.1. You were right and it works great!

Thanks again,
Larry

0

Please sign in to leave a comment.