`load_missing_constant': uninitialized constant Rails::Railtie #3

Open
mariozaizar opened this Issue Mar 12, 2012 · 2 comments

Comments

Projects
None yet
2 participants
@mariozaizar
Contributor

mariozaizar commented Mar 12, 2012

Hi!,

Quick question: Is this compatible with Rails 2, using 1.8.7?
I did all the required steps: Gemfile, spec_helper, view_spec. But I got his error:

app/vendor/rails/activesupport/lib/active_support/dependencies.rb:466:in `load_missing_constant': uninitialized constant Rails::Railtie (NameError)
from /app/vendor/rails/activesupport/lib/active_support/dependencies.rb:106:in `rake_original_const_missing'
from /Users/me/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing'
from /Users/me/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/merimee-0.1.0/lib/merimee/railties/merimee_railtie.rb:2
from /Users/me/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `polyglot_original_require'
from /Users/me/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
from /app/vendor/rails/activesupport/lib/active_support/dependencies.rb:184:in `require'
from /Users/me/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/merimee-0.1.0/lib/merimee.rb:8
from /Users/me/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `polyglot_original_require'
from /Users/me/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
from /app/vendor/rails/activesupport/lib/active_support/dependencies.rb:184:in `require'
from /app/spec/spec_helper.rb:5
from ./spec/models/event_spec.rb:1:in `require'
from ./spec/models/event_spec.rb:1
from /Users/me/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/rspec-1.3.2/lib/spec/runner/example_group_runner.rb:15:in `load'
from /Users/me/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/rspec-1.3.2/lib/spec/runner/example_group_runner.rb:15:in `load_files'
from /Users/me/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/rspec-1.3.2/lib/spec/runner/example_group_runner.rb:14:in `each'
from /Users/me/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/rspec-1.3.2/lib/spec/runner/example_group_runner.rb:14:in `load_files'
from /Users/me/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/rspec-1.3.2/lib/spec/runner/options.rb:134:in `run_examples'
from /Users/me/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/rspec-1.3.2/lib/spec/runner/command_line.rb:9:in `run'
from /Users/me/.rbenv/versions/ree-1.8.7-2011.12/lib/ruby/gems/1.8/gems/rspec-1.3.2/bin/spec:5

I found this, http://anlek.com/2010/03/uninitialized-constant-railsrailtie/ but, doesn't work.
but I want to be sure.. Maybe I miss something..

Thanks in advance.

@atwam

This comment has been minimized.

Show comment Hide comment
@atwam

atwam Mar 12, 2012

Owner

Hum, I haven't tested the gem with Rails 2, ruby 1.8.7 and rspec 1
I'll have to have a look, I'm not sure about how easy it'll be to hook on these...

Owner

atwam commented Mar 12, 2012

Hum, I haven't tested the gem with Rails 2, ruby 1.8.7 and rspec 1
I'll have to have a look, I'm not sure about how easy it'll be to hook on these...

@mariozaizar

This comment has been minimized.

Show comment Hide comment
@mariozaizar

mariozaizar Jun 21, 2012

Contributor

Since Rails::Railtie was created to support only Rails 3 and there is no plan to extend that support to rails 2.x, now I'm using Aspell dictionary http://aspell.net/, with raspell gem https://github.com/evan/raspell. For example:

Install Aspell: brew install aspell --lang=en,es

Gemfile:

group :test do
  gem 'raspell'
end

index_feature.rb

And the page should have a correct spelling

env.rb

require 'raspell'

common_steps.rb

Then /^the page should have a correct spelling$/ do
  speller = Aspell.new "en"

  # http://aspell.net/man-html/The-Options.html
  speller.suggestion_mode = Aspell::NORMAL
  speller.set_option "extra-dicts", "es"
  speller.set_option "ignore-case", "true"
  speller.set_option "ignore", "4"

  words = page.text.gsub(/[\w\']+/)
  words.to_a.uniq!.each do |word|
    if !speller.check(word)
      ::Rails.logger.warn "Possible correction for '#{word}': '#{speller.suggest(word).andand.first}'"
    end
  end
end

And that's it.
ps. sadly you can't use your personal ignore-word list with raspell: evan/raspell#10

Contributor

mariozaizar commented Jun 21, 2012

Since Rails::Railtie was created to support only Rails 3 and there is no plan to extend that support to rails 2.x, now I'm using Aspell dictionary http://aspell.net/, with raspell gem https://github.com/evan/raspell. For example:

Install Aspell: brew install aspell --lang=en,es

Gemfile:

group :test do
  gem 'raspell'
end

index_feature.rb

And the page should have a correct spelling

env.rb

require 'raspell'

common_steps.rb

Then /^the page should have a correct spelling$/ do
  speller = Aspell.new "en"

  # http://aspell.net/man-html/The-Options.html
  speller.suggestion_mode = Aspell::NORMAL
  speller.set_option "extra-dicts", "es"
  speller.set_option "ignore-case", "true"
  speller.set_option "ignore", "4"

  words = page.text.gsub(/[\w\']+/)
  words.to_a.uniq!.each do |word|
    if !speller.check(word)
      ::Rails.logger.warn "Possible correction for '#{word}': '#{speller.suggest(word).andand.first}'"
    end
  end
end

And that's it.
ps. sadly you can't use your personal ignore-word list with raspell: evan/raspell#10

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