diff options
author | Josh Kalderimis <josh.kalderimis@gmail.com> | 2011-05-12 09:24:42 +0200 |
---|---|---|
committer | Josh Kalderimis <josh.kalderimis@gmail.com> | 2011-05-12 09:24:42 +0200 |
commit | a0000d0ea096dc3c6f811b57d006a80d59057e53 (patch) | |
tree | 284a7ce2bd46cad00c62a630cf1863982c774ca3 /activerecord/lib | |
parent | 8cf4725f640603944bb6e69816807f6541c94d9f (diff) | |
download | rails-a0000d0ea096dc3c6f811b57d006a80d59057e53.tar.gz rails-a0000d0ea096dc3c6f811b57d006a80d59057e53.tar.bz2 rails-a0000d0ea096dc3c6f811b57d006a80d59057e53.zip |
updated AR#create! to accept an options hash so the mass-assignment security role can be passed in, also updated the Changelog to mention the change to some of the AR method signatures.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/session_store.rb | 4 | ||||
-rw-r--r-- | activerecord/lib/active_record/validations.rb | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/session_store.rb b/activerecord/lib/active_record/session_store.rb index 98e21db908..c3e976002e 100644 --- a/activerecord/lib/active_record/session_store.rb +++ b/activerecord/lib/active_record/session_store.rb @@ -40,7 +40,7 @@ module ActiveRecord # You must implement these methods: # # self.find_by_session_id(session_id) - # initialize(hash_of_session_id_and_data) + # initialize(hash_of_session_id_and_data, options_hash = {}) # attr_reader :session_id # attr_accessor :data # save @@ -125,7 +125,7 @@ module ActiveRecord end end - def initialize(attributes = nil) + def initialize(attributes = nil, options = {}) @data = nil super end diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index de36dd20b3..59b6876135 100644 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -32,11 +32,11 @@ module ActiveRecord module ClassMethods # Creates an object just like Base.create but calls <tt>save!</tt> instead of +save+ # so an exception is raised if the record is invalid. - def create!(attributes = nil, &block) + def create!(attributes = nil, options = {}, &block) if attributes.is_a?(Array) - attributes.collect { |attr| create!(attr, &block) } + attributes.collect { |attr| create!(attr, options, &block) } else - object = new(attributes) + object = new(attributes, options) yield(object) if block_given? object.save! object |