Skip to content

clean up endorsements with no valid skills #285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/skill.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Skill < ActiveRecord::Base
BLANK = ''

belongs_to :user
has_many :endorsements
has_many :endorsements, dependent: :delete_all

validates_presence_of :tokenized
validates_presence_of :user_id
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CleanupEndorsementsWithoutSkill < ActiveRecord::Migration
def up
Endorsement.delete_all(skill_id: [nil,''])
end

def down
raise ActiveRecord::IrreversibleMigration
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 => 20150103105333) do
ActiveRecord::Schema.define(:version => 20150108152023) do

add_extension "citext"
add_extension "hstore"
Expand Down