In regards to not having your categories selected when editing a post.
Change your unless code block to the following in posts/edit.rhtml
<% unless @categories.empty? %>
<% @selected = @post.categories.collect { |c| c.category_id.to_i } %>
<select name="post[category_ids][]" multiple="multiple">
<%= options_from_collection_for_select(@categories, :id, :title, @selected) %><br/><br/>
</select>
<% end %>
|
Now go back to list, refresh, click edit and it should now highlight all categories you have selected for that post.