Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.

Commit 819baf7

Browse files
authored
Fix Migrations Error: wrong number of arguments (2 for 0..1) (#2)
* v1.2.2 - Add ActiveRecord::Core patch to fix Rails 5 migrations
1 parent b52d32d commit 819baf7

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

lib/protected_attributes.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require 'active_record/core'
12
require "active_model/mass_assignment_security"
23
require "protected_attributes/railtie" if defined? Rails::Railtie
34
require "protected_attributes/version"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module ProtectedAttributes
2-
VERSION = "1.2.1"
2+
VERSION = "1.2.2"
33
end
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
11
require "protected_attributes"
2+
3+
module ActiveRecord
4+
module Core
5+
def initialize(attributes = nil, options = {})
6+
@attributes = self.class._default_attributes.dup
7+
self.class.define_attribute_methods
8+
9+
init_internals
10+
initialize_internals_callback
11+
12+
# +options+ argument is only needed to make protected_attributes gem easier to hook.
13+
init_attributes(attributes, options) if attributes
14+
15+
yield self if block_given?
16+
_run_initialize_callbacks
17+
end
18+
end
19+
end

0 commit comments

Comments
 (0)