Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invited? method on user conflicts with Devise invitable #38

Open
guanglunw opened this issue Feb 11, 2013 · 1 comment
Open

invited? method on user conflicts with Devise invitable #38

guanglunw opened this issue Feb 11, 2013 · 1 comment

Comments

@guanglunw
Copy link

Came across an interesting issue today, where approving friendships was failing, complaining that the number of arguments provided was incorrect.

It seems that amistad and devise invitable conflict by both adding the 'invited?' method to the model. Anyone have any good solutions for this, if I absolutely need both gems?

For now, some monkey-patching is letting me work around the issue, but given that I'm overriding 'approve', it's not exactly robust:

In an initialiser:

module Amistad
  module ActiveRecordFriendModel
    def approve(user)
      friendship = find_any_friendship_with(user)
      return false if friendship.nil? || friendship_invited?(user)
      friendship.update_attribute(:pending, false)
    end
    alias_method :friendship_invited?, :invited?
  end
end

Any suggestions on a better long term solution?

@marceloboeira
Copy link

@guanglunw sorry but, what the devise invitable does? you could override with devise_approve ... or something ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants