Ruby on Rails check box not updating on form submission
- by user284194
I have an entries controller that allows users to add contact information the website. The user-submitted information isn't visible to users until the administrator checks a check box and submits the form. So basically my problem is that if I check the check box as an administrator while initially creating an entry (entries#new) the entry will be publicly visible as expected, but if a non-admin user creates an entry (the normal user view doesn't include the 'live' check box, only the admin one does) then that entry is stuck in limbo because the entries#edit view for some reason doesn't update the boolean check box value when logged in as an admin.
entries#new view:
<% form_for(@entry) do |f| %>
<%= f.error_messages %>
Name<br />
<%= f.text_field :name %>
Mailing Address<br />
<%= f.text_field :address %>
#...
<%- if current_user -%>
<%= f.label :live %><br />
<%= f.check_box :live %>
<%- end -%>
<%= f.submit 'Create' %>
<% end %>
entries#edit (only accessible by admin) view:
<% form_for(@entry) do |f| %>
<%= f.error_messages %>
<%= f.label :name %><br />
<%= f.text_field :name %>
Mailing Address<br />
<%= f.text_field :address %>
<%= f.label :live %><br />
<%= f.check_box :live %>
<%= f.submit 'Update' %>
<% end %>
Any ideas as to why an administrator can't update the :live check box from the edit view?
I would greatly appreciate any suggestions. I'm new to rails. I can post more code if it's needed. Thanks for reading my question.