Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix router template of scaffold generator for models with name compose of more than 1 word #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tyraeltong
Copy link

One example:

rails g scaffold TestCase name:string content:string
rake db:migrate
rails g backbone:scaffold TestCase name:string content:string

the router gets generated would be like:

class AppName.Routers.TestCasesRouter extends Backbone.Router
initialize: (options) ->
@testCases = new AppName.Collections.TestCasesCollection()
@testCases.reset options.testCases
...
newTestCase: ->
@view = new AppName.Views.TestCases.NewView(collection: @test_case)
...
index: ->
@view = new AppName.Views.TestCases.IndexView(test_case: @test_case) 

While it should stick to camel name convention for js code, use testCase instead of test_case. And there're some other part of the code is using something like options.testCases but here you passed in test_case hence the problem like 'bind' is not a function on 'undefined' would happen.

@rohitnair
Copy link

I faced the same issue with multiple word model names as well. The fix mentioned here seems to work. Might be a good idea to merge this in?

@johnmcaliley
Copy link

+1 for merging this

@seabre
Copy link

seabre commented May 22, 2012

+1 as well. Please merge this.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants