Sha256: 2ed78fe1b23b480392d447c02a12c602be608cbb69cbc3f3dc130050b05bfe78
Contents?: true
Size: 581 Bytes
Versions: 170
Compression:
Stored size: 581 Bytes
Contents
class RemovePermissionFunction < ActiveRecord::Migration def up remove_column :permissions, :function ts = RelationPermission.record_timestamps RelationPermission.record_timestamps = false Permission.all.each do |p| q = Permission.find_by_action_and_object p.action, p.object next if p == q p.relation_permissions.each do |rp| rp.update_attribute :permission_id, q.id end p.reload.destroy end RelationPermission.record_timestamps = ts end def down add_column :permissions, :function, :string end end
Version data entries
170 entries across 170 versions & 4 rubygems