dev_trainings
daiao 6 years ago
parent fa1c12a923
commit aeec652649

@ -1,6 +1,7 @@
class Discuss < ActiveRecord::Base class Discuss < ActiveRecord::Base
belongs_to :user belongs_to :user
attr_accessible :user_id, :content, :dis_id, :dis_type, :parent_id, :praise_count, :root_id, :challenge_id, :position, :reward attr_accessible :user_id, :content, :dis_id, :dis_type, :parent_id, :praise_count, :root_id, :challenge_id,
:position, :reward, :hidden
default_scope :order => 'created_at desc' default_scope :order => 'created_at desc'
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy has_many :praise_tread, as: :praise_tread_object, dependent: :destroy

@ -71,7 +71,6 @@ class DiscussesService
begin begin
base_dicuss params[:id] base_dicuss params[:id]
hidden = current_user.admin? ? false : true hidden = current_user.admin? ? false : true
Rails.logger.info("############hidden: #{hidden}")
discuss = Discuss.create!(:content => params[:content].gsub("&nbsp\;", "").strip, :user_id => current_user.id, :parent_id => params[:id], discuss = Discuss.create!(:content => params[:content].gsub("&nbsp\;", "").strip, :user_id => current_user.id, :parent_id => params[:id],
:root_id => @discuss.root_id || params[:id], :praise_count => 0, :challenge_id => @discuss.challenge_id, :hidden => hidden, :root_id => @discuss.root_id || params[:id], :praise_count => 0, :challenge_id => @discuss.challenge_id, :hidden => hidden,
:dis_id => @discuss.dis_id, :dis_type => @discuss.dis_type, :position => @discuss.position) :dis_id => @discuss.dis_id, :dis_type => @discuss.dis_type, :position => @discuss.position)

Loading…
Cancel
Save