judgegem / judge

Client-side form validation for Rails
MIT License
256 stars 41 forks source link

mailboxer raise an error after added judge initializer for validates uniqueness #43

Closed apinrdw closed 9 years ago

apinrdw commented 9 years ago

This issue came when i added judge initializer to expose User email.

The error raise 'method_missing': undefined local variable or method 'acts_as_messageable'. judge

When i comment the initializer everything is work fine. tested using Rails 4.1.8 and 4.1.6 with Ruby 2.1.2.

joecorcoran commented 9 years ago

Hmm, sounds like a load order issue. How are you expecting acts_as_messageable to be made available to your project? Bundler?

apinrdw commented 9 years ago

I think its Bundler. acts_as_messageable is a module from mailboxer gem. Is there problem with load order in my gemfile?

apinrdw commented 9 years ago

I got another bug to sorcery gem , since i already remove the mailboxer gem.

If i initialize Judge configure on config/initializers/judge.rb Any methods and attributes defined on sorcery is inaccessible. Maybe happen to another, i not test everything.

solution: added to config/application.rb

config.after_initialize do
  Judge.configure do
    expose User, :email, :username
    # etc
  end
end

I think this will solve the issue, maybe can update the doc... :)