Merge pull request #47 from finnlabs/feature/rails3_sti
commit
fed4587f2f
@ -1,9 +1,13 @@ |
||||
class ChangeIssuePositionColumn < ActiveRecord::Migration |
||||
def self.up |
||||
change_column :issues, :position, :integer, :null => true, :default => nil |
||||
if ActiveRecord::Base.connection.table_exists? 'issues' |
||||
change_column :issues, :position, :integer, :null => true, :default => nil |
||||
end |
||||
end |
||||
|
||||
def self.down |
||||
change_column :issues, :position, :integer, :null => false |
||||
if ActiveRecord::Base.connection.table_exists? 'issues' |
||||
change_column :issues, :position, :integer, :null => false |
||||
end |
||||
end |
||||
end |
||||
|
@ -0,0 +1,7 @@ |
||||
class AddBacklogsColumnToWorkPackage < ActiveRecord::Migration |
||||
def change |
||||
add_column :work_packages, :position, :integer |
||||
add_column :work_packages, :story_points, :integer |
||||
add_column :work_packages, :remaining_hours, :float |
||||
end |
||||
end |
@ -0,0 +1,17 @@ |
||||
module OpenProject::Backlogs::Mixins |
||||
module PreventIssueSti |
||||
# overriding ActiveRecord::Inheritance::ClassMethods#sti_name |
||||
# so that stories are stored and found with type-attribute = "Issue" |
||||
def sti_name |
||||
"Issue" |
||||
end |
||||
|
||||
# overriding ActiveRecord::Inheritance::ClassMethods#find_sti_classes |
||||
# so that stories are instantiated correctly despite sti_name beeing "Issue" |
||||
def find_sti_class(type_name) |
||||
type_name = self.to_s if type_name == "Issue" |
||||
|
||||
super(type_name) |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue