Hotfix: Error when changing articles status

This commit is contained in:
Luke Barratt 2014-04-07 11:09:15 +01:00
parent 4aa83bf4cd
commit 849f81e27d
2 changed files with 3 additions and 3 deletions

View file

@ -55,7 +55,7 @@ class ArticlesController < ApplicationController
def update def update
raise AccessError unless @article.can_update? cuser, params[:article] 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) flash[:notice] = t(:articles_update)
redirect_to @article redirect_to @article
else else

View file

@ -114,11 +114,11 @@ class Article < ActiveRecord::Base
if (new_record? or status_changed?) and status == STATUS_PUBLISHED if (new_record? or status_changed?) and status == STATUS_PUBLISHED
case category.domain case category.domain
when Category::DOMAIN_NEWS 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 Notifications.news p.user, self if p.user
end end
when Category::DOMAIN_ARTICLES 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 Notifications.article p.user, self if p.user
end end
end end