app/controllers/admin/posts_controller.rb in tb_blog-1.4.1 vs app/controllers/admin/posts_controller.rb in tb_blog-1.4.2

- old
+ new

@@ -19,13 +19,11 @@ def show end def update - if @post.update_attributes(post_params) - flash[:notice] = 'Post was successfully updated.' - end + flash[:notice] = 'Post was successfully updated.' if @post.update(post_params) respond_with @post, location: admin_posts_path end def new @post = SpudPost.new(published_at: Time.zone.now, spud_user_id: current_user.id) @@ -64,12 +62,10 @@ end end def post_params permitted = [:published_at, :title, :content, :spud_user_id, :url_name, :visible, :comments_enabled, :meta_keywords, :meta_description, :content_format, :custom_author, category_ids: []] - if Spud::Blog.permitted_attributes.present? - permitted += Spud::Blog.permitted_attributes - end + permitted += Spud::Blog.permitted_attributes if Spud::Blog.permitted_attributes.present? p = params.require(:spud_post).permit(permitted) p[:updated_at] = DateTime.now return p end