Does anyone have any experience with upgrading the Casein gem when they upgrade to Rails3?
When I upgraded my app to Rails 3 I came across an issue with the Casein 3.1.0 gem.
It is breaking my cucumber tests with the following error:
undefined local variable or method `casein_config_email_from_address' for Casein::CaseinNotification:Class (NameError)
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/actionmailer-3.0.3/lib/action_mailer/deprecated_api.rb:74:in `method_missing'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/actionmailer-3.0.3/lib/action_mailer/base.rb:427:in `method_missing'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/casein-3.1.0/app/mailers/casein/casein_notification.rb:8:in `<class:CaseinNotification>'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/casein-3.1.0/app/mailers/casein/casein_notification.rb:6:in `<module:Casein>'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/casein-3.1.0/app/mailers/casein/casein_notification.rb:1:in `<top (required)>'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `block in require'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:227:in `load_dependency'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:346:in `require_or_load'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:300:in `depend_on'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:216:in `require_dependency'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/railties-3.0.3/lib/rails/engine.rb:138:in `block (2 levels) in eager_load!'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/railties-3.0.3/lib/rails/engine.rb:137:in `each'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/railties-3.0.3/lib/rails/engine.rb:137:in `block in eager_load!'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/railties-3.0.3/lib/rails/engine.rb:135:in `each'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/railties-3.0.3/lib/rails/engine.rb:135:in `eager_load!'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/railties-3.0.3/lib/rails/application/railties.rb:11:in `each'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/railties-3.0.3/lib/rails/application/railties.rb:11:in `all'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/railties-3.0.3/lib/rails/application.rb:107:in `eager_load!'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/railties-3.0.3/lib/rails/application/finisher.rb:41:in `block in <module:Finisher>'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `instance_exec'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `run'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/railties-3.0.3/lib/rails/initializable.rb:50:in `block in run_initializers'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `each'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `run_initializers'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/railties-3.0.3/lib/rails/application.rb:134:in `initialize!'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing'
/Users/camillavk/Documents/Work/Saild/saild/config/environment.rb:7:in `<top (required)>'
/Users/camillavk/Documents/Work/Saild/saild/features/support/env.rb:8:in `require'
/Users/camillavk/Documents/Work/Saild/saild/features/support/env.rb:8:in `<top (required)>'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/lib/cucumber/rb_support/rb_language.rb:143:in `load'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/lib/cucumber/rb_support/rb_language.rb:143:in `load_code_file'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/lib/cucumber/runtime/support_code.rb:171:in `load_file'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/lib/cucumber/runtime/support_code.rb:82:in `each'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/lib/cucumber/runtime.rb:137:in `load_step_definitions'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/lib/cucumber/runtime.rb:39:in `run!'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/lib/cucumber/cli/main.rb:43:in `execute!'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/lib/cucumber/cli/main.rb:20:in `execute'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/cucumber-1.1.2/bin/cucumber:14:in `<top (required)>'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/bin/cucumber:23:in `load'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/bin/cucumber:23:in `<main>'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/bin/ruby_executable_hooks:15:in `eval'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/bin/ruby_executable_hooks:15:in `<main>'
But the method IS defined in the Casein::ConfigHelper:
module Casein::ConfigHelper
# Text string containing the name of the website or client
# Used in text and titles throughout Casein
def casein_config_website_name
'Casein'
end
# URL to the logo used for the login screen and top banner - it should be a transparent PNG
def casein_config_logo
'/casein/images/casein.png'
end
# The server hostname where Casein will run
def casein_config_hostname
if ENV['RAILS_ENV'] == 'production'
'http://ift.tt/1DyltTL'
else
'http://localhost:3000'
end
end
# The sender email address used for notifications
def casein_config_email_from_address
'donotreply@caseincms.com'
end
# The page that the user is shown when they login or click the logo
# do not point this at casein/index!
def casein_config_dashboard_url
url_for :controller => :casein, :action => :blank
end
# A list of stylesheet files to include in the page head section
def casein_config_stylesheet_includes
['/casein/stylesheets/custom.css', '/casein/stylesheets/screen.css', '/casein/stylesheets/elements.css']
end
# A list of JavaScript files to include in the page head section
def casein_config_javascript_includes
['/casein/javascripts/custom.js', '/casein/javascripts/casein.js', '/javascripts/prototype.js']
end
end
and when I look at the file it mentions (/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/casein-3.1.0/app/mailers/casein/casein_notification.rb:8:in `') it has this:
module Casein
require 'casein/config_helper'
include Casein::ConfigHelper
class CaseinNotification < ActionMailer::Base
default :from => casein_config_email_from_address
self.prepend_view_path File.join(File.dirname(__FILE__), '..', 'views', 'casein')
....
end
I don't know why it's not seeing the method and don't know if I'm meant to change the default :from => casein_config_email_from_address
or not?
Aucun commentaire:
Enregistrer un commentaire