names with multiple words doesn't seems to work #117

Open
gouthamvel opened this Issue May 7, 2012 · 3 comments

Projects

None yet

4 participants

@gouthamvel

rails g backbone:scaffold StoreItems title:string content:string

index_view.js:27Uncaught TypeError: Cannot call method 'bind' of undefined

@rylwin
rylwin commented May 9, 2012

I had this exact same issue (just took me 30min to debug it, just getting around to playing w/ backbone!). It's due to an inconsistency of the name conversion (i.e., you sometimes see store_items and sometime storeItems in the js). This leads to an undefined error.

I also think I ran across a similar issue with namespaces (e.g, Namespace::ObjectName). I got inconsistent naming across the backbone classes generated by the scaffold, but I need to research this a bit more.

Is anyone currently working on these issues?

@wuliwong
wuliwong commented Nov 4, 2012

I just encountered this same problem. I put it up on StackOverflow. http://stackoverflow.com/questions/13204368/rails-backbone-gem-error-for-model-with-two-word-names-uncaught-typeerror-cann#comment17979301_13204368

Essentially you just have to do a find and replace and change every 'storeItems' to 'store_items'. I would assume the find and replace the other direction would work as well, I just did it the way I mentioned. I'm not sure which choice would be better.

This issue should get labeled a bug, right?

@westonplatter
Contributor

@wuliwong cc/ @rylwin @gouthamvel

I think this would be an issue. I started a different repo (http://westonplatter.com/railsy_backbone) that mimics this repo, but has updated Backbone and Underscore. I'd also like to have JS testing around jquery-rails and Backbone integration.

I'll confirm if the described issue exists in http://westonplatter.com/railsy_backbone, and if issue is there there, fix it. :). Happy to work other PRs through the system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment