%= form_for(@post) do |f| %>
<% if @post.errors.any? %>
<%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:
<% @post.errors.full_messages.each do |msg| %>
- <%= msg %>
<% end %>
<% end %>
<% @categories.each do |c| %>
- <%= check_box_tag "post[category_ids][]", c.id, @post.categories.include?(c) %>
<%= c.name %>
<%- end -%>
<%= f.label :published %>
<%= f.check_box :published %>
<%= f.label :title %>
<%= f.text_field :title %>
<%= f.label :date %>
<%= f.datetime_select :date %>
<%= f.label :excerpt %>
<%= f.text_area :excerpt %>
<%= f.label :body %>
<%= f.text_area :body %>
<%= f.submit %>
<% end %>