friendly-attributes 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
3
|
|
4
|
+
### 0.6.0
|
5
|
+
* (ihoka) Added #friendly_details_build_options method to the ActiveRecord model, allowing to specify default attributes when initially building the Friendly model.
|
6
|
+
|
4
7
|
### 0.5.0
|
5
8
|
|
6
9
|
* (ihoka) Added configurable active_record_key to the FriendlyDetails model. active_record_key affects the name of the generated Friendly index table and the attribute in which the ActiveRecord model ID is stored. It defaults to :active_record_id.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module FriendlyAttributes
|
2
2
|
class Details
|
3
3
|
class << self
|
4
|
-
def find_or_build_by_active_record_id(active_record_id)
|
5
|
-
active_record_id && first(active_record_key => active_record_id) || new(active_record_key => active_record_id)
|
4
|
+
def find_or_build_by_active_record_id(active_record_id, options={})
|
5
|
+
active_record_id && first(active_record_key => active_record_id) || new(options.merge(active_record_key => active_record_id))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -27,7 +27,7 @@ module FriendlyAttributes
|
|
27
27
|
after_destroy :destroy_friendly_details
|
28
28
|
|
29
29
|
define_method(:details) do
|
30
|
-
@details ||= friendly_model.find_or_build_by_active_record_id(id)
|
30
|
+
@details ||= friendly_model.find_or_build_by_active_record_id(id, friendly_details_build_options)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: friendly-attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 6
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.6.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Istvan Hoka
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-04 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|