Class: Discussion

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/discussion.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#new_messageObject

Returns the value of attribute new_message.



5
6
7
# File 'app/models/discussion.rb', line 5

def new_message
  @new_message
end

Instance Method Details

#new_message_attributes=(attributes) ⇒ Object



12
13
14
15
16
17
# File 'app/models/discussion.rb', line 12

def new_message_attributes=(attributes)
  unless attributes["body"].blank?
    self.new_message ||= ForumMessage.new(:discussion=>self)
    self.new_message.attributes = attributes
  end
end

#save_new_messageObject



8
9
10
# File 'app/models/discussion.rb', line 8

def save_new_message
  self.new_message.save if self.new_message
end