Sha256: 8d6fa9076778eddf14beea5caee125472a95fec63ce5122b86f620e74ebc1732

Contents?: true

Size: 431 Bytes

Versions: 59

Compression:

Stored size: 431 Bytes

Contents

class Discussion < ActiveRecord::Base
  belongs_to :forum
  has_many :forum_messages

  attr_accessor :new_message
  after_save :save_new_message

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

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

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
wheels-0.1.30 app/models/discussion.rb
wheels-0.1.28 app/models/discussion.rb
wheels-0.1.27 app/models/discussion.rb
wheels-0.1.25 app/models/discussion.rb
wheels-0.1.24 app/models/discussion.rb
wheels-0.1.23 app/models/discussion.rb
wheels-0.1.22 app/models/discussion.rb
wheels-0.1.21 app/models/discussion.rb
wheels-0.1.20 app/models/discussion.rb
wheels-0.1.19 app/models/discussion.rb
wheels-0.1.18 app/models/discussion.rb
wheels-0.1.17 app/models/discussion.rb
wheels-0.1.16 app/models/discussion.rb
wheels-0.1.15 app/models/discussion.rb
wheels-0.1.14 app/models/discussion.rb
wheels-0.1.13 app/models/discussion.rb
wheels-0.1.12 app/models/discussion.rb
wheels-0.1.10 app/models/discussion.rb
wheels-0.1.9 app/models/discussion.rb
wheels-0.1.8 app/models/discussion.rb