mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +00:00
Use safe_attributes.
git-svn-id: http://svn.redmine.org/redmine/trunk@15669 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
adde498b33
commit
dca56a0350
@ -31,13 +31,15 @@ class TrackersController < ApplicationController
|
||||
end
|
||||
|
||||
def new
|
||||
@tracker ||= Tracker.new(params[:tracker])
|
||||
@tracker ||= Tracker.new
|
||||
@tracker.safe_attributes = params[:tracker]
|
||||
@trackers = Tracker.sorted.to_a
|
||||
@projects = Project.all
|
||||
end
|
||||
|
||||
def create
|
||||
@tracker = Tracker.new(params[:tracker])
|
||||
@tracker = Tracker.new
|
||||
@tracker.safe_attributes = params[:tracker]
|
||||
if @tracker.save
|
||||
# workflow copy
|
||||
if !params[:copy_workflow_from].blank? && (copy_from = Tracker.find_by_id(params[:copy_workflow_from]))
|
||||
@ -58,7 +60,8 @@ class TrackersController < ApplicationController
|
||||
|
||||
def update
|
||||
@tracker = Tracker.find(params[:id])
|
||||
if @tracker.update_attributes(params[:tracker])
|
||||
@tracker.safe_attributes = params[:tracker]
|
||||
if @tracker.save
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class Tracker < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
CORE_FIELDS_UNDISABLABLE = %w(project_id tracker_id subject description priority_id is_private).freeze
|
||||
# Fields that can be disabled
|
||||
@ -69,6 +70,14 @@ class Tracker < ActiveRecord::Base
|
||||
joins(:projects).where(condition).distinct
|
||||
}
|
||||
|
||||
safe_attributes 'name',
|
||||
'default_status_id',
|
||||
'is_in_roadmap',
|
||||
'core_fields',
|
||||
'position',
|
||||
'custom_field_ids',
|
||||
'project_ids'
|
||||
|
||||
def to_s; name end
|
||||
|
||||
def <=>(tracker)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user