diff options
author | Joe Sak <joe@joesak.com> | 2011-07-12 16:39:33 -0500 |
---|---|---|
committer | Joe Sak <joe@joesak.com> | 2011-07-12 16:39:33 -0500 |
commit | c82a32ed3e3cc45e3425ae360b8a537a6ad367a1 (patch) | |
tree | 6daba14d6a69249836717f71d12035ecee0aa32c /app/controllers/admin/blog/posts_controller.rb | |
parent | 8aad45e5b04121a63760edec98fb2205a9111b48 (diff) | |
download | refinerycms-blog-c82a32ed3e3cc45e3425ae360b8a537a6ad367a1.tar.gz refinerycms-blog-c82a32ed3e3cc45e3425ae360b8a537a6ad367a1.tar.bz2 refinerycms-blog-c82a32ed3e3cc45e3425ae360b8a537a6ad367a1.zip |
this is the 'railscasts' way of handling the category checkboxes
Diffstat (limited to 'app/controllers/admin/blog/posts_controller.rb')
-rw-r--r-- | app/controllers/admin/blog/posts_controller.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/admin/blog/posts_controller.rb b/app/controllers/admin/blog/posts_controller.rb index dbf13b2..2b124ba 100644 --- a/app/controllers/admin/blog/posts_controller.rb +++ b/app/controllers/admin/blog/posts_controller.rb @@ -1,7 +1,8 @@ module Admin module Blog class PostsController < Admin::BaseController - + before_filter :check_category_ids, :only => :update + crudify :blog_post, :title_attribute => :title, :order => 'published_at DESC' @@ -85,6 +86,10 @@ module Admin def find_all_categories @blog_categories = BlogCategory.find(:all) end + + def check_category_ids + params[:blog_post][:category_ids] ||= [] + end end end end
\ No newline at end of file |