lifo / cramp

Real-time web application framework in Ruby
http://cramp.in
MIT License
1.5k stars 121 forks source link

Issue with activerecord functionality #20

Closed jalkoby closed 13 years ago

jalkoby commented 13 years ago

I try create and run cramp application with activerecord functionality, but when I run server it give me error:

/root/cs/application.rb:27:in `initialize!': uninitialized constant Cs::Application::ActiveRecord (NameError)
    from config.ru:2:in `block in <main>'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/rack-1.3.2/lib/rack/builder.rb:51:in `instance_eval'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/rack-1.3.2/lib/rack/builder.rb:51:in `initialize'
    from config.ru:1:in `new'
    from config.ru:1:in `<main>'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/thin-1.2.11/lib/rack/adapter/loader.rb:36:in `eval'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/thin-1.2.11/lib/rack/adapter/loader.rb:36:in `load'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/thin-1.2.11/lib/thin/controllers/controller.rb:181:in `load_rackup_config'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/thin-1.2.11/lib/thin/controllers/controller.rb:71:in `start'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/thin-1.2.11/lib/thin/runner.rb:185:in `run_command'
    from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/thin-1.2.11/lib/thin/runner.rb:151:in `run!'
    from /usr/local/bin/cramp:16:in `<main>'

After adding

require 'active_record'

Server start. Is anybody have that problem, or it's only in my system?

lifo commented 13 years ago

Just to be sure, did you run bundle install ?

jalkoby commented 13 years ago

Yes I run bundle install, that install active record gem. But issue, on my opinion, that require is missing or come to late

dylanvee commented 13 years ago

I had the same issue. To fix it, in your Gemfile change gem 'activerecord' to gem 'activerecord', :require => 'active_record'.

lifo commented 13 years ago

Oops. Good catch @dylanvee. I've pushed a fix https://github.com/lifo/cramp/commit/9b8e0b869715fad9ac40d663a8e71422b9068e5a

Thanks.