Avoid calling attr_protected if _accessible is used

When attr_accessible is used, we may assume that watcher_ids and
watcher_user_ids is already protected from mass assignment. Therefore we do not
need to perform additional actions.

Also, when attr_protected and attr_accessible is used on the same model, AR
throws nasty "Declare either attr_protected or attr_accessible for *, but not
both." errors.
pull/41/head
Gregor Schmidt 13 years ago
parent 1c1a7c9d84
commit ad1f36b16d
  1. 2
      vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb

@ -20,7 +20,7 @@ module Redmine
{ :include => :watchers,
:conditions => ["#{Watcher.table_name}.user_id = ?", user_id] }
}
attr_protected :watcher_ids, :watcher_user_ids
attr_protected :watcher_ids, :watcher_user_ids if accessible_attributes.nil?
end
end
end

Loading…
Cancel
Save