From ae34ba833e90c07190530845c9b0f583d6728266 Mon Sep 17 00:00:00 2001 From: Luke Barratt <luke@barratt.me> Date: Mon, 7 Apr 2014 11:09:15 +0100 Subject: [PATCH] Hotfix: Error when changing articles status --- app/controllers/articles_controller.rb | 2 +- app/models/article.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb index 9fda95e..a909aca 100644 --- a/app/controllers/articles_controller.rb +++ b/app/controllers/articles_controller.rb @@ -55,7 +55,7 @@ class ArticlesController < ApplicationController def update raise AccessError unless @article.can_update? cuser, params[:article] - if @article.update_attributes params[:article] + if @article.update_attributes(params[:article]) flash[:notice] = t(:articles_update) redirect_to @article else diff --git a/app/models/article.rb b/app/models/article.rb index c2edaf1..c0c5128 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -114,11 +114,11 @@ class Article < ActiveRecord::Base if (new_record? or status_changed?) and status == STATUS_PUBLISHED case category.domain when Category::DOMAIN_NEWS - Profile.all(includes: :user, conditions: "notify_news = 1").each do |p| + Profile.includes(:user).all(conditions: "notify_news = 1").each do |p| Notifications.news p.user, self if p.user end when Category::DOMAIN_ARTICLES - Profile.all(includes: :user, conditions: "notify_articles = 1").each do |p| + Profile.includes(:user).all(conditions: "notify_articles = 1").each do |p| Notifications.article p.user, self if p.user end end