Reputation:
<%= f.check_box(:is_active, {checked: (@employee.is_active ? false : true) }, 0, 1) %>
but I want to add class inside this how it will be done.
I had tried it like this:
<%= f.check_box(:is_active, {checked: (@employee.is_active ? false : true) }, 0, 1, :class=> 'abcd') %>
But it gives me error.Please guide me how to do this.
Upvotes: 1
Views: 4942
Reputation: 1601
You can use like this:
<%= f.check_box(:is_active, {checked: (@employee.is_active ? false : true) ,:class=> 'abcd'}, 0, 1) %>
Upvotes: 3
Reputation: 9747
Try this:
<%= f.check_box(:is_active, {checked: [email protected]_active, class: 'eula_check' }, 0, 1) %>
Upvotes: 0
Reputation: 5812
You might have to put the class inside the options hash like this:
<%= f.check_box(:is_active, { checked: (@employee.is_active ? false : true), class: 'abcd' }, 0, 1) %>
Upvotes: 0