fix: use the old style #force_attributes

pull/41/head
Martin Linkhorst 13 years ago
parent 12bb66c264
commit 696ed97dcd
  1. 5
      app/models/issue.rb
  2. 6
      app/models/member.rb

@ -121,9 +121,8 @@ class Issue < ActiveRecord::Base
def copy_from(arg)
issue = arg.is_a?(Issue) ? arg : Issue.visible.find(arg)
# project_id is protected from mass-assignment
self.attributes = issue.attributes.dup.except("id", "root_id", "parent_id", "lft", "rgt", "created_on", "updated_on", "project_id")
self.project_id = issue.attributes['project_id']
# project_id is protected from mass assignment
self.force_attributes = issue.attributes.dup.except("id", "root_id", "parent_id", "lft", "rgt", "created_on", "updated_on")
self.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h}
self.status = issue.status
self

@ -74,10 +74,8 @@ class Member < ActiveRecord::Base
# Find or initilize a Member with an id, attributes, and for a Principal
def self.edit_membership(id, new_attributes, principal=nil)
@membership = id.present? ? Member.find(id) : Member.new(:principal => principal)
# project_id is protected from mass-assignment
project_id = new_attributes.delete('project_id')
@membership.attributes = new_attributes
@membership.project_id = project_id
# project_id is protected from mass assignment
@membership.force_attributes = new_attributes
@membership
end

Loading…
Cancel
Save