E
E
eldar_web2018-05-24 16:29:03
Ruby on Rails
eldar_web, 2018-05-24 16:29:03

How to make the checkbox active by default in Ransack?

I do this: I remove it, and then after submitting the form it remains marked again. How to fix?
f.check_box :active_true, {checked: true}, 1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
blackst0ne, 2018-05-25
@eldar_web

You have . Therefore, the checkbox will always be in the state when the page is opened. Instead , you need to substitute logic. For example:checked: truechecked

f.check_box :active_true, { checked: @user.active? }, ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question