ruby - Uninitialized constant Version (NameError) when starting Rails server -
so had app working fine , had migrate on new development server. copied files over, ran bundle install no errors , when run rails server
i error.
=> ctrl-c shutdown server exiting c:/sites/mysite/app/admin/version.rb:1:in <top (required)>': uninitialized con stant version (nameerror) c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 5.1/lib/active_admin/application.rb:190:inblock in load!' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 5.1/lib/active_admin/application.rb:190:in each' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 5.1/lib/active_admin/application.rb:190:inload!' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 5.1/lib/active_admin/application.rb:213:in routes' c:inroutes' c:/sites/mysite/config/routes.rb:13:in `block in ' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 .11/lib/action_dispatch/routing/route_set.rb:282:in instance_exec' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 .11/lib/action_dispatch/routing/route_set.rb:282:ineval_block' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 .11/lib/action_dispatch/routing/route_set.rb:260:in draw' c:/sites/mysite/config/routes.rb:1:in' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/application/routes_reloader.rb:40:in block in load_paths' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/application/routes_reloader.rb:40:ineach' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/application/routes_reloader.rb:40:in load_paths' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/application/routes_reloader.rb:16:inreload!' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/application.rb:108:in reload_routes!' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 5.1/lib/active_admin/reloader.rb:34:inreload!' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 5.1/lib/active_admin/reloader.rb:61:in block in attach!' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 3.2.11/lib/active_support/callbacks.rb:429:in_run__334365865__prepare__8021230 81__callbacks' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 3.2.11/lib/active_support/callbacks.rb:405:in __run_callback' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 3.2.11/lib/active_support/callbacks.rb:385:in_run_prepare_callbacks' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 3.2.11/lib/active_support/callbacks.rb:81:in run_callbacks' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 .11/lib/action_dispatch/middleware/reloader.rb:74:inprepare!' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 .11/lib/action_dispatch/middleware/reloader.rb:48:in prepare!' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/application/finisher.rb:47:inblock in module:finisher' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/initializable.rb:30:in instance_exec' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/initializable.rb:30:inrun' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/initializable.rb:55:in block in run_initializers' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/initializable.rb:54:ineach' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/initializable.rb:54:in run_initializers' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/application.rb:136:ininitialize!' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/railtie/configurable.rb:30:in method_missing' c:/sites/mysite/config/environment.rb:5:in' c:/sites/mysite/config.ru:3:in block in <main>' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib /rack/builder.rb:51:ininstance_eval' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib /rack/builder.rb:51:in initialize' c:/sites/mysite/config.ru:innew' c:/sites/mysite/config.ru:in <main>' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib /rack/builder.rb:40:ineval' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib /rack/builder.rb:40:in parse_file' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib /rack/server.rb:200:inapp' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/commands/server.rb:46:in app' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib /rack/server.rb:304:inwrapped_app' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib /rack/server.rb:254:in start' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/commands/server.rb:70:instart' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/commands.rb:55:in block in <top (required)>' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/commands.rb:50:intap' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/commands.rb:50:in <top (required)>' script/rails:6:inrequire' script/rails:6:in `
any clue what's going on here?
edit: code inside app/admin/version.rb
activeadmin.register version end
edit: routes.rb code
mysite::application.routes.draw activeadmin.routes(self) devise_for :users 'application/index' root :to => 'application#index' end
do have version.rb model. if not first generate model
rails generate model version name:string
it create model , migration version, add columns of choice in following code.
20150514124720_create_versions.rb
class createversions < activerecord::migration def change create_table :versions |t| t.string :name # add other attributes of choice here t.timestamps end end end
and, run migration
rake db:migrate
Comments
Post a Comment