我已更新會議插件。在此插件更新會議時,它不會更新會議歷史記錄。 像我改變主題會議更新主題,但不更新歷史問題。如何使用日記從Redmine插件添加歷史記錄
我的管理平臺的配置如下
Environment:
Redmine version 3.3.1.stable
Ruby version 2.1.5-p273 (2014-11-13) [x86_64-linux]
Rails version 4.2.7.1
Environment development
Database adapter Mysql2
我已經做了以下事項>
我的模型類
def init_journal(user, notes = "")
@current_journal ||= Journal.new(:journalized => self, :user => user, :notes => notes, :notify => false)
if new_record?
@current_journal.notify = false
else
@attributes_before_change = attributes.dup
end
@current_journal
end
def last_journal_id
if new_record?
nil
else
journals.maximum(:id)
end
end
# Returns a scope for journals that have an id greater than journal_id
def journals_after(journal_id)
scope = journals.reorder("#{Journal.table_name}.id ASC")
if journal_id.present?
scope = scope.where("#{Journal.table_name}.id > ?", journal_id.to_i)
end
scope
end
def create_journal
if @current_journal
# attributes changes
if @attributes_before_change
(Meeting.column_names - %w(id created_at updated_at)).each {|c|
before = @attributes_before_change[c]
after = send(c)
next if before == after || (before.blank? && after.blank?)
@current_journal.details << JournalDetail.new(:property => 'attr',
:prop_key => c,
:old_value => before,
:value => after)
}
end
@current_journal.save
# reset current journal
init_journal @current_journal.user, @current_journal.notes
end
end
和控制器類
def update_meeting_from_params
@edit_allowed = User.current.allowed_to?(:edit_meetings, @project)
@time_entry = TimeEntry.new(:meeting => @meeting, :project => @meeting.project)
@time_entry.attributes = params[:time_entry]
@meeting.init_journal(User.current)
meeting_attributes = params[:meeting]
@meeting.safe_attributes = meeting_attributes
end
我得到以下錯誤。 http://prntscr.com/eb257g 請幫我
哪個版本的管理平臺? –
它是最新版本。 我用我的環境更新了這個問題。 –
和哪個會議插件? –