activemodel 4.0.3 → 4.0.4.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/lib/active_model.rb +2 -2
- data/lib/active_model/conversion.rb +1 -1
- data/lib/active_model/naming.rb +6 -6
- data/lib/active_model/secure_password.rb +4 -5
- data/lib/active_model/validations/inclusion.rb +2 -1
- data/lib/active_model/validations/validates.rb +1 -1
- data/lib/active_model/validator.rb +1 -1
- data/lib/active_model/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a816ecc3d18076ab63730be05196adc8ff854e92
|
4
|
+
data.tar.gz: 8a0a6ef882727c2de169de462d85fdc7ae7c180f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7263d900a354401b223783b6be71c98a17c02a8b104be7f3ca8fa38afaffbe70af921341f472f7f402f3c6269c3b97e52aee9343a37bde0e07cfb35e2ce08b45
|
7
|
+
data.tar.gz: ab20a034845611352398a2334851c444ee1d90f71138b076caf74fc39f6d5a5cc6b0ca0baca957c2fbf7bbb2454972a83d5291ee95ad42959bbdf0f273a2f455
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
## Rails 4.0.4 ##
|
2
|
+
|
3
|
+
* `#to_param` returns `nil` if `#to_key` returns `nil`. Fixes #11399.
|
4
|
+
|
5
|
+
*Yves Senn*
|
6
|
+
|
7
|
+
|
8
|
+
## Rails 4.0.3 (February 18, 2014) ##
|
9
|
+
|
10
|
+
*No changes*
|
11
|
+
|
12
|
+
|
13
|
+
## Rails 4.0.2 (December 02, 2013) ##
|
14
|
+
|
15
|
+
*No changes*
|
16
|
+
|
17
|
+
|
1
18
|
## Rails 4.0.1 (November 01, 2013) ##
|
2
19
|
|
3
20
|
* Fix `has_secure_password` to honor bcrypt-ruby's cost attribute.
|
data/lib/active_model.rb
CHANGED
@@ -62,7 +62,7 @@ module ActiveModel
|
|
62
62
|
# person = Person.create
|
63
63
|
# person.to_param # => "1"
|
64
64
|
def to_param
|
65
|
-
persisted? ?
|
65
|
+
(persisted? && key = to_key) ? key.join('-') : nil
|
66
66
|
end
|
67
67
|
|
68
68
|
# Returns a +string+ identifying the path associated with the object.
|
data/lib/active_model/naming.rb
CHANGED
@@ -262,10 +262,10 @@ module ActiveModel
|
|
262
262
|
# namespaced models regarding whether it's inside isolated engine.
|
263
263
|
#
|
264
264
|
# # For isolated engine:
|
265
|
-
# ActiveModel::Naming.singular_route_key(Blog::Post) #=> post
|
265
|
+
# ActiveModel::Naming.singular_route_key(Blog::Post) #=> "post"
|
266
266
|
#
|
267
267
|
# # For shared engine:
|
268
|
-
# ActiveModel::Naming.singular_route_key(Blog::Post) #=> blog_post
|
268
|
+
# ActiveModel::Naming.singular_route_key(Blog::Post) #=> "blog_post"
|
269
269
|
def self.singular_route_key(record_or_class)
|
270
270
|
model_name_from_record_or_class(record_or_class).singular_route_key
|
271
271
|
end
|
@@ -274,10 +274,10 @@ module ActiveModel
|
|
274
274
|
# namespaced models regarding whether it's inside isolated engine.
|
275
275
|
#
|
276
276
|
# # For isolated engine:
|
277
|
-
# ActiveModel::Naming.route_key(Blog::Post) #=> posts
|
277
|
+
# ActiveModel::Naming.route_key(Blog::Post) #=> "posts"
|
278
278
|
#
|
279
279
|
# # For shared engine:
|
280
|
-
# ActiveModel::Naming.route_key(Blog::Post) #=> blog_posts
|
280
|
+
# ActiveModel::Naming.route_key(Blog::Post) #=> "blog_posts"
|
281
281
|
#
|
282
282
|
# The route key also considers if the noun is uncountable and, in
|
283
283
|
# such cases, automatically appends _index.
|
@@ -289,10 +289,10 @@ module ActiveModel
|
|
289
289
|
# namespaced models regarding whether it's inside isolated engine.
|
290
290
|
#
|
291
291
|
# # For isolated engine:
|
292
|
-
# ActiveModel::Naming.param_key(Blog::Post) #=> post
|
292
|
+
# ActiveModel::Naming.param_key(Blog::Post) #=> "post"
|
293
293
|
#
|
294
294
|
# # For shared engine:
|
295
|
-
# ActiveModel::Naming.param_key(Blog::Post) #=> blog_post
|
295
|
+
# ActiveModel::Naming.param_key(Blog::Post) #=> "blog_post"
|
296
296
|
def self.param_key(record_or_class)
|
297
297
|
model_name_from_record_or_class(record_or_class).param_key
|
298
298
|
end
|
@@ -18,9 +18,9 @@ module ActiveModel
|
|
18
18
|
# value to the password_confirmation attribute and the the validation
|
19
19
|
# will not be triggered.
|
20
20
|
#
|
21
|
-
# You need to add bcrypt
|
21
|
+
# You need to add bcrypt (~> 3.1.7) to Gemfile to use #has_secure_password:
|
22
22
|
#
|
23
|
-
# gem 'bcrypt
|
23
|
+
# gem 'bcrypt', '~> 3.1.7'
|
24
24
|
#
|
25
25
|
# Example using Active Record (which automatically includes ActiveModel::SecurePassword):
|
26
26
|
#
|
@@ -40,14 +40,13 @@ module ActiveModel
|
|
40
40
|
# User.find_by(name: 'david').try(:authenticate, 'notright') # => false
|
41
41
|
# User.find_by(name: 'david').try(:authenticate, 'mUc3m00RsqyRe') # => user
|
42
42
|
def has_secure_password(options = {})
|
43
|
-
# Load bcrypt
|
43
|
+
# Load bcrypt gem only when has_secure_password is used.
|
44
44
|
# This is to avoid ActiveModel (and by extension the entire framework)
|
45
45
|
# being dependent on a binary library.
|
46
46
|
begin
|
47
|
-
gem 'bcrypt-ruby', '~> 3.1.2'
|
48
47
|
require 'bcrypt'
|
49
48
|
rescue LoadError
|
50
|
-
$stderr.puts "You don't have bcrypt
|
49
|
+
$stderr.puts "You don't have bcrypt installed in your application. Please add it to your Gemfile and run bundle install"
|
51
50
|
raise
|
52
51
|
end
|
53
52
|
|
@@ -29,7 +29,8 @@ module ActiveModel
|
|
29
29
|
# * <tt>:in</tt> - An enumerable object of available items. This can be
|
30
30
|
# supplied as a proc, lambda or symbol which returns an enumerable. If the
|
31
31
|
# enumerable is a numerical range the test is performed with <tt>Range#cover?</tt>,
|
32
|
-
# otherwise with <tt>include?</tt>.
|
32
|
+
# otherwise with <tt>include?</tt>. When using a proc or lambda the instance
|
33
|
+
# under validation is passed as an argument.
|
33
34
|
# * <tt>:within</tt> - A synonym(or alias) for <tt>:in</tt>
|
34
35
|
# * <tt>:message</tt> - Specifies a custom error message (default is: "is
|
35
36
|
# not included in the list").
|
@@ -13,7 +13,7 @@ module ActiveModel
|
|
13
13
|
# validates :terms, acceptance: true
|
14
14
|
# validates :password, confirmation: true
|
15
15
|
# validates :username, exclusion: { in: %w(admin superuser) }
|
16
|
-
# validates :email, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\
|
16
|
+
# validates :email, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, on: :create }
|
17
17
|
# validates :age, inclusion: { in: 0..9 }
|
18
18
|
# validates :first_name, length: { maximum: 30 }
|
19
19
|
# validates :age, numericality: true
|
@@ -61,7 +61,7 @@ module ActiveModel
|
|
61
61
|
# end
|
62
62
|
#
|
63
63
|
# Note that the validator is initialized only once for the whole application
|
64
|
-
#
|
64
|
+
# life cycle, and not on each validation run.
|
65
65
|
#
|
66
66
|
# The easiest way to add custom validators for validating individual attributes
|
67
67
|
# is with the convenient <tt>ActiveModel::EachValidator</tt>.
|
data/lib/active_model/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activemodel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.4.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.0.
|
19
|
+
version: 4.0.4.rc1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.0.
|
26
|
+
version: 4.0.4.rc1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: builder
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,12 +99,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: 1.9.3
|
100
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- - "
|
102
|
+
- - ">"
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version:
|
104
|
+
version: 1.3.1
|
105
105
|
requirements: []
|
106
106
|
rubyforge_project:
|
107
|
-
rubygems_version: 2.2.
|
107
|
+
rubygems_version: 2.2.2
|
108
108
|
signing_key:
|
109
109
|
specification_version: 4
|
110
110
|
summary: A toolkit for building modeling frameworks (part of Rails).
|