Open gabrieletassoni opened 1 year ago
I'm having the exact same issue for rails_admin
3.1.1 and rails
7.0.4.
I fixed it on my side for now by adding
attribute :your_bool_field_here, ActiveModel::Type::Boolean.new
in my model.
I think the problem is in https://github.com/railsadminteam/rails_admin/blob/master/lib/rails_admin/config/fields/types/boolean.rb function form_value
. The value was '1' instead of true. Telling active_record that it was a boolean did the trick, but it was the first time I had to do that.
any updates here? This is still broken for me!
I've added a spec for this, but as you can see it's working. https://github.com/railsadminteam/rails_admin/commit/10bf495f2e69c7dcbccb360026ee875461d1f22f
Are you sure that you're using the column type boolean
, not integer
or something?
@mshibuya I realized our use case actually diverges just a bit. We are using store_accessor :document, :my_boolean_field
. Things don't work great in that scenario, even though we are marking the field as :boolean
Ideally, nullable and nonnullable would be something that has an override config. OR, :nullable_boolean
would be a different type
Describe the bug On the Create and Edit UIs the checkboxes for non nullable boolean fields does not seem to wokr, clicking on them does not show a checkmark.
Reproduction steps Add a non nullable field to a model (in this case User)
Run
rails s
Open the browser to http://localhost:3000 and navigate to User page generated by rails admin. Click on "Create +" button. The admin field created in the migration, does not work as expected.Expected behavior I expect to see the checkmark appear if I click on it.
Additional context
rails
version: 7rails_admin
version: 3.1.2rails_admin
npm package version: not used, using sprockets