お問い合わせフォームを処理するための単純なモデルを作成しました。
class ContactForm
include ActiveAttr::Model
attribute :name
attribute :email
attribute :message
attr_accessible :name, :email, :message
validates_presence_of :name, :email, :message
validates_format_of :email, :with => /^[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9] {2,4}$/i
end
開発環境では問題なく動作しますが、運用サーバーではエラーが発生し、ユニコーン ログに記録されます。
E, [2013-01-26T18:15:42.724973 #8940] ERROR -- : uninitialized constant ContactForm::ActiveAttr (NameError)
Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.11'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'pg'
gem 'bootstrap-sass'
gem 'font-awesome-sass-rails'
# gem 'acts_as_tree', :git => 'git://github.com/amerine/acts_as_tree.git'
gem 'closure_tree'
gem 'kaminari'
gem 'friendly_id'
gem 'slim'
gem 'gmaps4rails'
gem 'devise'
gem 'omniauth'
gem 'oauth2'
gem 'omniauth-facebook'
gem 'omniauth-twitter'
gem 'simple_form'
gem 'pg_search'
gem 'stamp'
gem 'acts-as-taggable-on', '~> 2.3.1'
gem 'rmagick'
gem 'carrierwave'
gem 'active_attr'
gem 'select2-rails'
# gem 'roo'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
gem 'compass-rails'
end
group :development do
gem "better_errors"
gem "binding_of_caller"
gem 'guard'
gem 'letter_opener'
end
group :test do
gem 'minitest'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
gem 'unicorn'
# Deploy with Capistrano
gem 'capistrano'
# To use debugger
# gem 'debugger'
gem 'bullet', :group => :development
gem 'rack-mini-profiler'