Skip to content
This repository has been archived by the owner on May 18, 2021. It is now read-only.

Commit

Permalink
add recalculating migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyfrank committed Mar 21, 2013
1 parent 951a3a8 commit 0247aa1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions db/migrate/20130320200122_recalculate_votings.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class RecalculateVotings < ActiveRecord::Migration
def up
Lecture.find_each do |lecture|
lecture.lecture_votings_count = lecture.lecture_votings.count
lecture.listener_votings_count = lecture.listener_votings.count
lecture.save!
end
end

def down
end
end
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20130320112135) do
ActiveRecord::Schema.define(:version => 20130320200122) do

create_table "audits", :force => true do |t|
t.integer "auditable_id"
Expand Down

0 comments on commit 0247aa1

Please sign in to comment.