Code Monkey home page Code Monkey logo

Comments (26)

gonzalo-bulnes avatar gonzalo-bulnes commented on May 26, 2024

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.

from simple_token_authentication.

austinpray avatar austinpray commented on May 26, 2024

^^^^ Take note. This guy right here is a proper repo owner.

from simple_token_authentication.

exocode avatar exocode commented on May 26, 2024

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 ActiveSupport::Validations or similar stuff I do

class Item
  include Mongoid::Document
  include ActiveModel::Validations
  # this is a Mongoid model along with ActiveModel::Validations
end

I hope this helps. Looking forward! :-)

from simple_token_authentication.

exocode avatar exocode commented on May 26, 2024

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.

from simple_token_authentication.

gonzalo-bulnes avatar gonzalo-bulnes commented on May 26, 2024

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.

from simple_token_authentication.

exocode avatar exocode commented on May 26, 2024

Thank YOU! for making this gem! :-)

from simple_token_authentication.

Angelmmiguel avatar Angelmmiguel commented on May 26, 2024

Is this solved? Now, I'm cloning the repo of @mediatainment. Thanks for these gems! :D

from simple_token_authentication.

gonzalo-bulnes avatar gonzalo-bulnes commented on May 26, 2024

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!

from simple_token_authentication.

Angelmmiguel avatar Angelmmiguel commented on May 26, 2024

Hi @gonzalo-bulnes!

I'm new on ruby on rails, but I'll try it ;). Thanks!

from simple_token_authentication.

exocode avatar exocode commented on May 26, 2024

it works for me like a charm...

from simple_token_authentication.

gonzalo-bulnes avatar gonzalo-bulnes commented on May 26, 2024

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!

from simple_token_authentication.

exocode avatar exocode commented on May 26, 2024

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.

from simple_token_authentication.

a14m avatar a14m commented on May 26, 2024

@gonzalo-bulnes ... first of all thanks for the gem... secondly is the mongoid support near ?
also put the reference to the off topic issue you have with mongoid and cucumber... which i might work on in my free time.

from simple_token_authentication.

prem-prakash avatar prem-prakash commented on May 26, 2024

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)

from simple_token_authentication.

exocode avatar exocode commented on May 26, 2024

@prem-prakash are you sure you have installed mongoid correctly?

try

require 'mongoid'

from simple_token_authentication.

prem-prakash avatar prem-prakash commented on May 26, 2024

I am using setup described here: http://mongoid.org/en/mongoid/docs/installation.html
It don't use

require 'mongoid'

In my Gemfile I have

gem 'rails', '4.0.3'
gem 'mongoid', github: 'mongoid/mongoid'
gem 'simple_token_authentication', github: 'mediatainment/simple_token_authentication'

Also my models are using mongoid with no problem.

from simple_token_authentication.

prem-prakash avatar prem-prakash commented on May 26, 2024

Adding

require 'mongoid'

to beginning of lib//simple_token_authentication/acts_as_token_authenticatable.rb
make it works

from simple_token_authentication.

gonzalo-bulnes avatar gonzalo-bulnes commented on May 26, 2024

Hi @prem-prakash,

Thanks for the feedback, I wonder what in your setup is different from the @mediatainment (and others) setup.

from simple_token_authentication.

prem-prakash avatar prem-prakash commented on May 26, 2024

Hi @gonzalo-bulnes and @mediatainment
As I can see it is a dependency problem, which can be solved at gemspec file.
I will make a pull request.

from simple_token_authentication.

oliviermilla avatar oliviermilla commented on May 26, 2024

Any update on this?

from simple_token_authentication.

a14m avatar a14m commented on May 26, 2024

@mediatainment Fork works fine for me...

from simple_token_authentication.

gonzalo-bulnes avatar gonzalo-bulnes commented on May 26, 2024

Hi @muichkine,

there are little news in #97, and the @mediatainment fork is a good way to go in the meanwhile : )

Regards!

from simple_token_authentication.

oliviermilla avatar oliviermilla commented on May 26, 2024

The @mediatainment fork doesn't work here. As soon as I call acts_as_token_authentication_handler_for User in my controller, I can't start the server and get the following error:

muichkine@ubuntu:~/src/white$ rails s
=> Booting Puma
=> Rails 4.1.6 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Exiting
/home/muichkine/src/white/app/models/user.rb:18:in `<class:User>': undefined method `devise' for User:Class (NoMethodError)
from /home/muichkine/src/white/app/models/user.rb:1:in `<top (required)>'

As soon as I remove the call from the controller, my devise codes go back to normal. :)

from simple_token_authentication.

gonzalo-bulnes avatar gonzalo-bulnes commented on May 26, 2024

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!

from simple_token_authentication.

gonzalo-bulnes avatar gonzalo-bulnes commented on May 26, 2024

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!

from simple_token_authentication.

austinpray avatar austinpray commented on May 26, 2024

🍻

from simple_token_authentication.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.