codebrew / backbone-rails

Easily use backbone.js with rails 3.1
MIT License
1.62k stars 255 forks source link

scaffold not work if model name contains undersore ('_') #103

Open kiinoo opened 12 years ago

kiinoo commented 12 years ago

Here are my steps, really simple:

rails new m1

Modify gemfile

gem 'authlogic' gem "rails-backbone" gem 'haml-rails' gem 'eventmachine', '1.0.0.beta.4.1' gem 'thin'

Run scaffold

rails g backbone:install rails generate scaffold organization_type name:string rails generate backbone:scaffold organization_type name:string

Modify model and js model: Organization

Update seeds

OrganizationType.delete_all OrganizationType.create!([{name: 'department'}]) OrganizationType.create!([{name: 'workshop'}])

Update index.html.haml as below;

organization_types

:javascript $(function() { window.router = new M1.Routers.OrganizationTypesRouter({organization_types: #{@organization_types.to_json.html_safe}}); Backbone.history.start(); });

rake db:migrate & rake db:seed

start rails and browse to http://localhost:3000/organization_types

the data won't show up!

unless I modified organization_types_router.js.coffee manually by replacing 'organizationTypes' to 'organization_types', the link worked