At 9:49, my response.responseText contained {"name":["can't be blank"]}
and not {"errors": {"name":["can't be blank"]}} (i.e. there was no "errors" key).
So when parsing the messages within entries/index.js.coffee#handleError method, I did
coffee
errors=$.parseJSON(response.responseText)
instead of
coffee
errors=$.parseJSON(response.responseText).errors
I have rails 3.1.2, and my web browser is Chrome 16.0.912.77.
Hey Alan,
You were correct. Originally I followed your instructions and added a "require tree ." in the last line. But for whatever reason, I left the original "require tree ." in the line above. So the problem was still there (and Stuart spotted that in his comment below).
I noticed that I get the same error trace even at 3:45. When I look at the html file being generated, I see that raffler.js is placed before backbone.js. So the raffler script is being loaded before backbone?
// This is a manifest file that'll be compiled into including all the files listed below.// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically// be included in the compiled file accessible from http://example.com/assets/application.js// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the// the compiled file.////= require jquery//= require jquery_ujs//= require_tree .//= require underscore//= require backbone////= require .//raffler////= require_tree ../templates///= require_tree .//models//= require_tree .//collections//= require_tree .//views//= require_tree .//routers//= require_tree .
Hey Alan,
Thanks for the post. I added the line, but it is still giving the same error trace. I restarted the server and everything. I even started from fresh in another computer (running Ubuntu 11.04). Same problem (I tried both Chrome and Firefox browsers). I am following Ryan's instructions step by step.
Before I spend time digging deep into this, any other help/suggestions will be really appreciated.
I don't get the "home page" alert dialogue at 5:35. Note that I did get the "Hello from Backbone" alert at 3:45.
Any help will really be appreciated. I am running rails 3.1.2 in Ubuntu 10.04.
Also note that I had to include the gem "therubyracer" to get the server running at the start (I was facing the issue similar to https://github.com/rails/rails/issues/2963)
Below are the relevant parts of the code and the error trace I get in the console.
At 9:49, my response.responseText contained
{"name":["can't be blank"]}
and not
{"errors": {"name":["can't be blank"]}}
(i.e. there was no "errors" key).So when parsing the messages within entries/index.js.coffee#handleError method, I did
instead of
I have rails 3.1.2, and my web browser is Chrome 16.0.912.77.
A nice introduction done at a good pace. Content was pretty informative. Thanks Ryan!
Hey Alan,
You were correct. Originally I followed your instructions and added a "require tree ." in the last line. But for whatever reason, I left the original "require tree ." in the line above. So the problem was still there (and Stuart spotted that in his comment below).
Thanks a lot!
Sunil
Hey Stuart,
You are correct. Not sure how I missed that other "require tree ." above. Thanks a lot.
Sunil
I noticed that I get the same error trace even at 3:45. When I look at the html file being generated, I see that raffler.js is placed before backbone.js. So the raffler script is being loaded before backbone?
My application.js file is as follows
Sunil
Hey Alan,
Thanks for the post. I added the line, but it is still giving the same error trace. I restarted the server and everything. I even started from fresh in another computer (running Ubuntu 11.04). Same problem (I tried both Chrome and Firefox browsers). I am following Ryan's instructions step by step.
Before I spend time digging deep into this, any other help/suggestions will be really appreciated.
Sunil
I don't get the "home page" alert dialogue at 5:35. Note that I did get the "Hello from Backbone" alert at 3:45.
Any help will really be appreciated. I am running rails 3.1.2 in Ubuntu 10.04.
Also note that I had to include the gem "therubyracer" to get the server running at the start (I was facing the issue similar to https://github.com/rails/rails/issues/2963)
Below are the relevant parts of the code and the error trace I get in the console.
app/assets/javascripts/routers/entries.js.coffee
app/assets/javascripts/raffler.js.coffee
The error trace I get in the console is:
In entries.js(5): Uncaught ReferenceError: Raffler is not defined
In entry.js(5): Uncaught ReferenceError: Raffler is not defined
In entries.js(23): Uncaught ReferenceError: Backbone is not defined
In index.js(17): Uncaught ReferenceError: Backbone is not defined
In raffler.js(9): Uncaught TypeError: Undefined is not a function