suweller / mongoid-autoinc

⬆ Auto incrementing fields for Mongoid documents
MIT License
62 stars 44 forks source link

Rails 4 support #14

Closed evsyukovmv closed 10 years ago

evsyukovmv commented 11 years ago

Rails 4 ActiveModel::Name not return string and attr_protected is extracted out into a gem.

suweller commented 11 years ago

Hi @evsyukovmv, thanks for your contribution! I have one remark about it though, see my previous comment

evsyukovmv commented 11 years ago

I removed check rails version, but I think this gem can also be useful in not rails application, for example in sinatra or simple rack applications, in this case method try will raise an exception, so I decided did not remove Rails check. What do you think about it?

suweller commented 11 years ago

I agree its best to keep gem dependencies down. :) In that case we could rely on plain ruby and do:

attr_protected(field) if respond_to?(:attr_protected)

If we also change the mongoid dependency to ~> 4.0 we're good to go for gem release 4.0.0

evsyukovmv commented 11 years ago

I'm so ashamed, I really should used "respond_to?". I do not know now whether my fixes are, this code is yours, and it might be better if you close my pull request and make your changes. About mongoid ~> 4.0 I can't specify version until it present only on github but not on rubygems.

johnnyshields commented 10 years ago

I'm in favor of changing to:

s.add_dependency 'mongoid', '>= 3.0'

If we do ~> 4.0 then we are forcing users to use 4.0... this gem looks like it should be compatible with both versions.