From 062fbeae80477b8e5a95b2e5222f98b7e94c70b7 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 18 Dec 2011 13:26:20 +0000 Subject: [PATCH] Makes models #initialize accept additional arguments. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8287 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/custom_field.rb | 2 +- app/models/project.rb | 2 +- app/models/query.rb | 2 +- app/models/user_preference.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb index 09cb03471..87285ed66 100644 --- a/app/models/custom_field.rb +++ b/app/models/custom_field.rb @@ -30,7 +30,7 @@ class CustomField < ActiveRecord::Base validate :validate_values before_validation :set_searchable - def initialize(attributes = nil) + def initialize(attributes=nil, *args) super self.possible_values ||= [] end diff --git a/app/models/project.rb b/app/models/project.rb index 831bdf07f..0d2dfc29c 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -95,7 +95,7 @@ class Project < ActiveRecord::Base end } - def initialize(attributes = nil) + def initialize(attributes=nil, *args) super initialized = (attributes || {}).stringify_keys diff --git a/app/models/query.rb b/app/models/query.rb index fad42fcb2..4cd8d36b9 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -163,7 +163,7 @@ class Query < ActiveRecord::Base } } - def initialize(attributes = nil) + def initialize(attributes=nil, *args) super attributes self.filters ||= { 'status_id' => {:operator => "o", :values => [""]} } end diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb index b2da867a3..836ec6b26 100644 --- a/app/models/user_preference.rb +++ b/app/models/user_preference.rb @@ -23,7 +23,7 @@ class UserPreference < ActiveRecord::Base before_save :set_others_hash - def initialize(attributes = nil) + def initialize(attributes=nil, *args) super self.others ||= {} end -- 2.39.5