-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 7.3.0
-
Component/s: Validations
-
None
-
Environment:Ubuntu/Ruby on rails/mongoid (7.3.0.alpha ff8fefa)
Hi
I am creating rails app with
Rails version: 6.1.3
Ruby version: 3.0.0
mongoid: mongoid (7.3.0.alpha ff8fefa)
When I took gem 'mongoid', '~> 7.2'
gave me issue of
Bundler could not find compatible versions for gem "activemodel":
In Gemfile:
mongoid (~> 7.2) x86_64-linux was resolved to 7.2.0, which depends on
activemodel (>= 5.1, < 6.1)
rails (~> 6.1.3) x86_64-linux was resolved to 6.1.3, which depends on
activemodel (= 6.1.3)
So I have to go for mongoid (7.3.0.alpha ff8fefa)
When I have added validations to my model
class Whatsapp
include Mongoid::Document
include Mongoid::Timestamps
field :mobile_number, type: String
field :message, type: String
field :api_response, type: String
validates :mobile_number, :message, :api_response, presence: true
end
3.0.0 :001 > w = Whatsapp.create!(mobile_number: "9898989898", message: "", api_response: "")
Traceback (most recent call last):
1: from (irb):1:in `<main>'
ArgumentError (wrong number of arguments (given 3, expected 1..2))
What is the issue?
- duplicates
-
MONGOID-5048 Validation Errors on Ruby 3
- Closed