Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
まとめ編集: まとめ編集時に更新日時が更新されない問題を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
YOSHIDA Hiroki committed Jan 13, 2014
1 parent ad7930e commit 21b4bd3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/matomes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def update
@matome = Matome.find(params[:id])
@matome.clip_ids = Clip.where(user_id: current_user.id, id: clip_ids).pluck(:id)

if @matome.update_attributes(params[:matome])
if @matome.force_update_attributes(params[:matome])
update_tags_for(@matome, tag_names)
redirect_to @matome, notice: "「#{@matome.title}」まとめを更新しました"
else
Expand Down
9 changes: 9 additions & 0 deletions app/models/concerns/active_record_extension.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
module ActiveRecordExtension
extend ActiveSupport::Concern

included do
def force_update_attributes(*args)
self.partial_updates = false
result = self.update_attributes(*args)
self.partial_updates = true
result
end
end

module ClassMethods
def without_record_timestamps
self.record_timestamps = false
Expand Down

0 comments on commit 21b4bd3

Please sign in to comment.