class Softapplication < ActiveRecord::Base attr_accessible :android_min_version_available, :app_type_id, :app_type_name, :description, :name, :user_id acts_as_attachable has_many :journals_for_messages, :as => :jour, :dependent => :destroy belongs_to :user def add_jour(user, notes, reference_user_id = 0, options = {}) if options.count == 0 self.journals_for_messages << JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id) else jfm = self.journals_for_messages.build(options) jfm.save jfm end end def set_commit(commit) self.update_attribute(:commit, commit) end end