Loenvpy
Loenvpy

Reputation: 919

Rails: How to know if checkbox is checked

I'm using rails and I'm trying to know if a check box is checked or not but didn't succeed this is what I'm using actually but didn't worked

<% if experience.is_current == 1 %> 

Update:

this is the experience schema

t.date     "experience_start"
t.date     "experience_end"
t.boolean  "is_current"

and this is my view

<% @profile.experiences.each do |exper| %>
<% if exper.is_current? %>
    <time>to present </time>
<% else %>
    <time> <%= exper.experience_end.strftime('%B-%Y ')  %> </time>
<% end %>
<% end %>

Upvotes: 1

Views: 1202

Answers (1)

spickermann
spickermann

Reputation: 106872

Your code looks fine. Did you check in the database if you have at least one experience that is marked as is_current?

Upvotes: 1

Related Questions