Boolean field ignored in mangoid query when creating railsadmin
I have a Mongolian model named Announcement:
class Announcement
include Mongoid::Document
include Mongoid::Timestamps
field :message
field :starts_at, type: DateTime
field :ends_at, type: DateTime
field :is_permanent, type: Boolean, default: false
end
Most things on this model seem to work fine:
Announcement.all.count
all ads are listed.
When I create an ad via the console:
Announcement.create(is_permanent: true, message: "Hi", starts_at: "2014-09-30", ends_at: "2014-10-30")
Announcement.where(is_permanent: true).to_a
returns it:
[#<Announcement _id: 542b5cfa53696d0656010000, created_at: 2014-10-01 01:46:34 UTC, updated_at: 2014-10-01 01:46:34 UTC, message: "Hi", starts_at: nil, ends_at: nil, is_permanent: true>]
However, when I create a declaration with a boolean field via RailsAdmin, it ends up in the database:
[#<Announcement _id: 542b4eae53696d0552000000, created_at: 2014-10-01 00:45:34 UTC, updated_at: 2014-10-01 01:12:07 UTC, message: "Cookies!", starts_at: nil, ends_at: nil, is_permanent: "1">]
and is_perantent "1"
.
As a result, the request is_permanent: true
does not return this ad.
Is this a bug with rails-admin? Am I missing something with my setup? Any help / thoughts are appreciated.
+3
source to share