Skip to content

Commit

Permalink
Remove support for the protected attributes gem
Browse files Browse the repository at this point in the history
Related to #10690.
  • Loading branch information
carlosantoniodasilva committed Jan 10, 2015
1 parent d8b8a72 commit f4fbc03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 4 additions & 0 deletions activerecord/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* Remove support for the `protected_attributes` gem.

*Carlos Antonio da Silva + Roberto Miranda*

* Fix accessing of fixtures having non-string labels like Fixnum.

*Prathamesh Sonpatki*
Expand Down
12 changes: 2 additions & 10 deletions activerecord/lib/active_record/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,14 @@ def table_metadata # :nodoc:
# ==== Example:
# # Instantiates a single new object
# User.new(first_name: 'Jamie')
def initialize(attributes = nil, options = {})
def initialize(attributes = nil)
@attributes = self.class._default_attributes.dup
self.class.define_attribute_methods

init_internals
initialize_internals_callback

# +options+ argument is only needed to make protected_attributes gem easier to hook.
# Remove it when we drop support to this gem.
init_attributes(attributes, options) if attributes
assign_attributes(attributes) if attributes

yield self if block_given?
_run_initialize_callbacks
Expand Down Expand Up @@ -557,12 +555,6 @@ def init_internals
def initialize_internals_callback
end

# This method is needed to make protected_attributes gem easier to hook.
# Remove it when we drop support to this gem.
def init_attributes(attributes, options)
assign_attributes(attributes)
end

def thaw
if frozen?
@attributes = @attributes.dup
Expand Down

3 comments on commit f4fbc03

@senny
Copy link
Member

@senny senny commented on f4fbc03 Dec 23, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@carlosantoniodasilva found this while working on the release notes for 5.0. Does mean that protected_attributes is not intended to work with Rails 5?

/cc @rafaelfranca

@matthewd
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@carlosantoniodasilva
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, it's Rails 4x only 👍

Please sign in to comment.