##// END OF EJS Templates
Makes models #initialize accept additional arguments....
Jean-Philippe Lang -
r8167:062fbeae8047
parent child
Show More
@@ -30,7 +30,7 class CustomField < ActiveRecord::Base
30 validate :validate_values
30 validate :validate_values
31 before_validation :set_searchable
31 before_validation :set_searchable
32
32
33 def initialize(attributes = nil)
33 def initialize(attributes=nil, *args)
34 super
34 super
35 self.possible_values ||= []
35 self.possible_values ||= []
36 end
36 end
@@ -95,7 +95,7 class Project < ActiveRecord::Base
95 end
95 end
96 }
96 }
97
97
98 def initialize(attributes = nil)
98 def initialize(attributes=nil, *args)
99 super
99 super
100
100
101 initialized = (attributes || {}).stringify_keys
101 initialized = (attributes || {}).stringify_keys
@@ -163,7 +163,7 class Query < ActiveRecord::Base
163 }
163 }
164 }
164 }
165
165
166 def initialize(attributes = nil)
166 def initialize(attributes=nil, *args)
167 super attributes
167 super attributes
168 self.filters ||= { 'status_id' => {:operator => "o", :values => [""]} }
168 self.filters ||= { 'status_id' => {:operator => "o", :values => [""]} }
169 end
169 end
@@ -23,7 +23,7 class UserPreference < ActiveRecord::Base
23
23
24 before_save :set_others_hash
24 before_save :set_others_hash
25
25
26 def initialize(attributes = nil)
26 def initialize(attributes=nil, *args)
27 super
27 super
28 self.others ||= {}
28 self.others ||= {}
29 end
29 end
General Comments 0
You need to be logged in to leave comments. Login now