some documentation regarding mass assignment, show full stack trace in console

pull/41/head
Martin Linkhorst 13 years ago
parent 696ed97dcd
commit 337561261a
  1. 2
      app/models/issue.rb
  2. 3
      app/models/member.rb
  3. 2
      config/initializers/backtrace_silencers.rb

@ -121,7 +121,7 @@ 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
# attributes don't come from form, so it's save to force assign
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

@ -74,7 +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
# interface refactoring needed
# not critical atm because only admins can invoke it (see users and groups controllers)
@membership.force_attributes = new_attributes
@membership
end

@ -18,4 +18,4 @@
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
Rails.backtrace_cleaner.remove_silencers!
Loading…
Cancel
Save