mailboxer: undefined local variable or method `acts_as_messageable'

I followed the docs, but am getting an error stating “undefined local variable or method `acts_as_messageable’” when I try to run my app or bring up the Rails console.

If it matters, my User model is a “standard” Devise user, and here’s the relevant code.

class User < ActiveRecord::Base
  acts_as_messageable

  has_one :project_professional
  has_many :projects
  has_many :bids
  has_many :ratings, through: :reviews

  after_create :mark_approved

  ROLES = %w[admin client project_professional moderator]
  # Include default devise modules. Others available are:
  # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable, :omniauthable,
         :recoverable, :rememberable, :trackable, :validatable

  # Setup accessible (or protected) attributes for your model
  attr_accessible :name, :email, :password, :password_confirmation, :remember_me, :roles, :user_type
...
end

Using the default Mailboxer initializer:

Mailboxer.setup do |config|

  #Configures if you applications uses or no the email sending for Notifications and Messages
  config.uses_emails = true

  #Configures the default from for the email sent for Messages and Notifications of Mailboxer
  config.default_from = "no-reply@mailboxer.com"

  #Configures the methods needed by mailboxer
  config.email_method = :mailboxer_email
  config.name_method = :name

  #Configures if you use or not a search engine and wich one are you using
  #Supported enignes: [:solr,:sphinx] 
  config.search_enabled = false
  config.search_engine = :solr
end

And the relevant bits of my Gemfile

gem 'rails', '3.2.2'
gem 'haml'
gem 'devise', '~> 2.0.0'
gem "omniauth-facebook"
gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
gem 'cancan'
gem 'paperclip', '~> 2.5.1'
gem 'acts-as-taggable-on'
gem 'forem', :git => "git://github.com/radar/forem.git"
gem 'redcarpet'
gem 'best_in_place'
gem 'simple_form'
gem 'gmaps4rails'
gem "kaminari"
gem "will_paginate"

gem 'mailboxer', git: 'git://github.com/ging/mailboxer.git'

Is my issue Rails 3.2.2? Any tips on how to resolve this would be greatly appreciated. Looks like a great gem.

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 27 (10 by maintainers)

Most upvoted comments

now it is extend Mailboxer::Models::Messageable::ActiveRecordExtension

In config/initializers/rails_admin.rb, after

RailsAdmin.config do |config|

add this

include Mailboxer::Models::Messageable

This worked for me.