You can clone with
HTTPS or Subversion.
Error's coming from:
In development (on a Mac), it seemed to work fine. Deployed to Heroku, and I'm getting this error. Do I have a configuration issue? Or perhaps that value should be cast to an integer before comparison? If so, I can submit a quick pull request if that makes it easier. Thanks either way.
Can you check database? Is invitation_limit an integer?
t.integer :invitation_limit, :default => 0
t.integer "invitation_limit", :default => 0
User Load (18.7ms) SELECT "users".* FROM "users" LIMIT 1
Let me know if you need any more info. Thanks.
Do you know user which was inviting? Can you test invitation_limit in that user?
I've got 5 set in the initializer, 0 set on all users in db. The plan is to not allow invites unless I set the limit to nil on a given user. I set the 5 since it seemed like you needed a value there for the db value to take effect.
Ok. Is it reproducible? Can you reproduce from the console? calling user.has_invitations_left? or user.invitation_limit
Interestingly, it's fine from the console:
User Load (4.9ms) SELECT "users".* FROM "users" LIMIT 1
User Load (8.3ms) SELECT "users".* FROM "users" LIMIT 1
User Load (12.2ms) SELECT "users".* FROM "users" LIMIT 1
But when I try to send an invitation from this user's account, I get this error:
2012-02-23T08:10:23+00:00 app[web.1]: Started POST "/users/invitation" for 126.96.36.199 at 2012-02-23 08:10:23 +0000
2012-02-23T08:10:23+00:00 app[web.1]: ArgumentError (comparison of String with 0 failed):
2012-02-23T08:10:23+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/devise_invitable-1.0.0/lib/devise_invitable/inviter.rb:18:in `>'
2012-02-23T08:10:23+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/devise_invitable-1.0.0/lib/devise_invitable/inviter.rb:18:in `has_invitations_left?'
2012-02-23T08:10:23+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/devise_invitable-1.0.0/app/controllers/devise/invitations_controller.rb:55:in `has_invitations_left?'
This isn't an emergency or anything. It's a production environment, but this app is still in development. I was just intrigued since it functioned properly on my laptop in development.
If you think of anything else you'd like me to check, let me know. Otherwise, don't worry about it too much. Haven't seen anyone else with this issue, so I'm guessing it's something about my configuration.
I'm intrigued too. It should never return a string
I've faced the same issue,when I run my app on production. Any solution for this ?
A failing test would be useful to reproduce it and fix it. If you don't know how to write the test or you cannot reproduce it in a test, I would need a sample application to reproduce it.
Can someone with this problem write a failing test? Or provide a sample app?
FYI, we had the same error only on production and a restart fixed it.