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

Mongoid 7.0 and 7.2 support #55

Open
muhammetfaik opened this issue May 21, 2019 · 8 comments
Open

Mongoid 7.0 and 7.2 support #55

muhammetfaik opened this issue May 21, 2019 · 8 comments

Comments

@muhammetfaik
Copy link

Help !!!

base) ➜  raceday git:(master) ✗ bundle
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Fetching gem metadata from https://rubygems.org/............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "mongoid":
  In snapshot (Gemfile.lock):
    mongoid (= 7.0.2)

  In Gemfile:
    mongoid (~> 7.0, >= 7.0.2)

    mongoid_enum was resolved to 1.1.0, which depends on
      mongoid (~> 5.0)

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

@wangaguo
Copy link

wangaguo commented Nov 3, 2020

Hi, Can you help to support new version mongoid.

@choilive
Copy link

choilive commented Dec 4, 2020

gem "mongoid-enum", :git => 'https://github.com/choilive/mongoid-enum.git'

I have updated it to support mongoid 7, looks like the maintainer is inactive for this project

@TimoPurzner
Copy link

@choilive pretty cool but I get errors if I try to install it I got ruby 3.0.0

current directory: ...../.rvm/gems/ruby-3.0.0/gems/bigdecimal-1.4.4/ext/bigdecimal
make "DESTDIR="
compiling bigdecimal.c
bigdecimal.c:421:5: error: implicit declaration of function 'rb_check_safe_obj' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    rb_check_safe_obj(str);
    ^
bigdecimal.c:421:5: note: did you mean 'rb_check_safe_str'?
/Users/timopurzner/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/ruby/internal/core/rstring.h:97:6: note: 'rb_check_safe_str' declared here
void rb_check_safe_str(VALUE);
     ^
bigdecimal.c:2030:6: error: implicit declaration of function 'rb_check_safe_obj' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            rb_check_safe_obj(f);
            ^
2 errors generated.
make: *** [bigdecimal.o] Error 1

@choilive
Copy link

@ZeroSoulEater hm yes, this gem depends on bigdecimal 1.4.x which is not compatible with ruby 3, I'll try upgrading bigdecimal 2.0 and see if it still works.

@jramiresbrito
Copy link

gem "mongoid-enum", :git => 'https://github.com/choilive/mongoid-enum.git'

I have updated it to support mongoid 7, looks like the maintainer is inactive for this project

Hey @choilive, thanks for update it!

I'm having problems on use the enum.

Basically my model have this field called type, like that:

field :type, type: Integer

Which will be a enum:
enum type: { type_1: 0, type_2: 1, type_3: 2 }

But i'm facing this error when I try to make a request passing type: "type_1":

"exception": "#<ArgumentError: wrong number of arguments (given 1, expected 2..3)>",

Any idea?

@choilive
Copy link

choilive commented Feb 4, 2021

@jramiresbrito hey!
it looks like you are trying to use enums in the style of ActiveRecord Enums, I dont think you can explicitly map between the attribute and the value in the same way here. The mongoid-enum gem does not try to be the same api as activerecord enum (it also came way before that was released)

something like enum :type, [:type_1, :type_2, :type_3] should work

@avijit-sharma
Copy link

@ZeroSoulEater hm yes, this gem depends on bigdecimal 1.4.x which is not compatible with ruby 3, I'll try upgrading bigdecimal 2.0 and see if it still works.

hey , is this working for ruby 3 ?,still showng error for me

@Vector54
Copy link

@choilive Hey friend! It's been some time now. How's it working for MongoId 8?

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

7 participants