-
Notifications
You must be signed in to change notification settings - Fork 238
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
Mongoid support? #38
Comments
Hi @hunterpp, Why not? Let's build it together, tell me what you need, and I'll make sure to back it with the proper testing. |
^^^^ Take note. This guy right here is a proper repo owner. |
Declaration for a mongoid model is normally this: class User < ActiveRecord::Base
# this is an AR model
end
class Item
include Mongoid::Document
# this is a Mongoid model
end So it seems ActiveRecord::Base.send :include, SimpleTokenAuthentication::ActsAsTokenAuthenticatable must be changed to: Mongoid::Document.send :include, SimpleTokenAuthentication::ActsAsTokenAuthenticatable . For class Item
include Mongoid::Document
include ActiveModel::Validations
# this is a Mongoid model along with ActiveModel::Validations
end I hope this helps. Looking forward! :-) |
a working example is here: https://github.com/mediatainment/simple_token_authentication I am sure a simple check "if ActiveRecord::Base defined" elsif Mongoid::Document defined" method extends the functionality of this gem for a lot of users. |
Hi @mediatainment! I'll be a bit AFK these days, but I'll start building Cucumber scenarii as soon as I can. That was exaclty the help I needed; many many thanks @mediatainment, really. |
Thank YOU! for making this gem! :-) |
Is this solved? Now, I'm cloning the repo of @mediatainment. Thanks for these gems! :D |
Hi @Angelmmiguel, Nope, it's work in progress, but your feedback about the @mediatainment fork would be welcome, particularly if your setup mixes Mongoid and ActiveRecord! |
Hi @gonzalo-bulnes! I'm new on ruby on rails, but I'll try it ;). Thanks! |
it works for me like a charm... |
Hi @mediatainment, all, I'm struggling with Gemfile-related issues in the testing environment, which are not directly related to Mongoid but which are preventing me from writing a Mongoid version of the existing Cucumber scenarii. Just for you know that I'm not forgetting about bringing Mongoid support to the gem :P The main point is that supporting Mongoid supposes to make sure the gem features will keep working with it in the future, and that's why the test suite is made for. That being said, it occurs that I haven't managed to be really free to use an arbitrary version of Rails when I build the dummy test app, and since Rails 4 get's installed by default, the Mongoid setup fails. I'm looking for solutions to that (which may be more related to Cucumber than they are to Mongoid) and in case someone had time to take a look at it, I could make make a detailed description of the issue, which is a bit off-topic here. That's one point. Another point, more mongoistic than the previous one: does any of you work with both Mongoid and ActiveRecord in the same application? All the forks I've seen replace one by the another. I'm not familiar with Mongoid, but I don't see any reason why they could not live together. In order to prepare such a testing scenario, any feedback on that would be greatly appreciated. Thanks for keeping an eye on this issue, best regards! |
I can only speak for me. No, I do not use these ORM-Adapters simultaneously. All my apps are using one DB per usage. Postgres, MySQL or Mondoid. |
@gonzalo-bulnes ... first of all thanks for the gem... secondly is the mongoid support near ? |
I am trying to use @mediatainment fork with no success. lib/simple_token_authentication/acts_as_token_authenticatable.rb:33:in `<top (required)>': uninitialized constant Mongoid (NameError) |
@prem-prakash are you sure you have installed mongoid correctly? try
|
I am using setup described here: http://mongoid.org/en/mongoid/docs/installation.html
In my Gemfile I have
Also my models are using mongoid with no problem. |
Adding
to beginning of lib//simple_token_authentication/acts_as_token_authenticatable.rb |
Hi @prem-prakash, Thanks for the feedback, I wonder what in your setup is different from the @mediatainment (and others) setup. |
Hi @gonzalo-bulnes and @mediatainment |
Any update on this? |
@mediatainment Fork works fine for me... |
Hi @muichkine, there are little news in #97, and the @mediatainment fork is a good way to go in the meanwhile : ) Regards! |
The @mediatainment fork doesn't work here. As soon as I call
As soon as I remove the call from the controller, my devise codes go back to normal. :) |
Hi @mediatainment, (and anyone interested!) If you have a moment, could you please take a look and give a try to this? # Gemfile
# ...
gem 'simple_token_authentication',
git: 'https://github.com/gonzalo-bulnes/simple_token_authentication.git',
branch: 'spike-add-mongoid-support-using-adapter'
# ... Thanks, regards! |
Add Mongoid as development dependency Add, enable MongoidAdapter Thanks to @mediatainment who contributed the "Mongoid support" part of this this commit a long time before it became production-ready and who litterally ensured the support for users in the meantime. See https://github.com/mediatainment/simple_token_authentication/ \ commit/6b30379ebed0f277487b63f3ec1e29129d598196 Fixes #38
Hello @hunterpp, @austinpray, @mediatainment, @Angelmmiguel, @artmees, @prem-prakash and @muichkine! I just released v1.6.0 which add support for Mongoid. I want to thank all of you for your comments and observations. Also for your patience which has been a great motivator to perform some deep refactoring (#104). The result is a speedy test suite which, I hope, is also easier for everyone to extend and will be beneficial in other scenarios. Here's 🎁 Mongoid support, looking forward for new ideas ; ) I checked the details with Rails 3.2.19 + Mongoid 3.1.6 and Rails 4.1.6 + Mongoid 4.0.0, both with and without ActiveRecord. Please, don't hesitate to raise any issue I could have missed, I'm sure most of you know more about Mongoid than I do. Regards! |
🍻 |
mongoid support?
The text was updated successfully, but these errors were encountered: