basecamp / mail_view

Visual email testing
MIT License
1.33k stars 126 forks source link

uninitialized constant MailPreview #66

Open adamwong246 opened 10 years ago

adamwong246 commented 10 years ago
/Users/r625503/Programming/projectv/config/routes.rb:4:in `block in <top (required)>': uninitialized constant MailPreview (NameError)
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/actionpack-3.2.16/lib/action_dispatch/routing/route_set.rb:285:in `instance_exec'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/actionpack-3.2.16/lib/action_dispatch/routing/route_set.rb:285:in `eval_block'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/actionpack-3.2.16/lib/action_dispatch/routing/route_set.rb:263:in `draw'
    from /Users/r625503/Programming/projectv/config/routes.rb:1:in `<top (required)>'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/bundler/gems/rails-dev-boost-3e25b06c5c53/lib/rails_development_boost/loadable_patch.rb:14:in `load'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.16/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.16/lib/rails/application/routes_reloader.rb:40:in `each'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.16/lib/rails/application/routes_reloader.rb:40:in `load_paths'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.16/lib/rails/application/routes_reloader.rb:16:in `reload!'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.16/lib/rails/application/routes_reloader.rb:26:in `block in updater'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/activesupport-3.2.16/lib/active_support/file_update_checker.rb:78:in `call'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/activesupport-3.2.16/lib/active_support/file_update_checker.rb:78:in `execute'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.16/lib/rails/application/routes_reloader.rb:27:in `updater'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.16/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.16/lib/rails/application/finisher.rb:66:in `block in <module:Finisher>'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.16/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.16/lib/rails/initializable.rb:30:in `run'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.16/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.16/lib/rails/initializable.rb:54:in `each'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.16/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.16/lib/rails/application.rb:136:in `initialize!'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.16/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /Users/r625503/Programming/projectv/config/environment.rb:5:in `<top (required)>'
    from /Users/r625503/Programming/projectv/config.ru:3:in `block in <main>'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
    from /Users/r625503/Programming/projectv/config.ru:in `new'
    from /Users/r625503/Programming/projectv/config.ru:in `<main>'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.16/lib/rails/commands/server.rb:46:in `app'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.16/lib/rails/commands/server.rb:70:in `start'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.16/lib/rails/commands.rb:55:in `block in <top (required)>'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.16/lib/rails/commands.rb:50:in `tap'
    from /Users/r625503/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.16/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Not sure why though. The gems in the gemfile and I copy-pasted the mounting call into routes.

ruby is at 2.0.0 and rails is at 3.2.16

wojtekmach commented 10 years ago

@adamwong246 what's the name of your mailer? README instructions are assuming it's MailPreview, if it's something different then you have to change the name of the class you're mounting in routes.

zakelfassi commented 10 years ago

as @wojtekmach mentioned, you should set the router -explicitely- as follows:

mount YourMailPreviewClassName, :at => 'your_endpoint'

(this should be closed as it's not a mail_view issue.)

andreapavoni commented 10 years ago

I've got the same error. Fixed by specifying to load the lib/ path in config/application.rb:

# ...
   config.autoload_paths += %W(#{config.root}/lib)
# ...