revolutionhealth-acts_as_seo_friendly 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/acts_as_seo_friendly.rb +1 -1
- data/test/test_acts_as_seo_friendly.rb +5 -0
- data/test/test_helper.rb +1 -0
- metadata +1 -1
data/lib/acts_as_seo_friendly.rb
CHANGED
@@ -65,7 +65,7 @@ module ActiveRecord
|
|
65
65
|
count_seo_id_field_N = "#{count_seo_id_field}_N"
|
66
66
|
|
67
67
|
resource_id_field = self.class.read_inheritable_attribute(:seo_friendly_options)[:resource_id].to_s
|
68
|
-
resource_id_value = self
|
68
|
+
resource_id_value = self.send(resource_id_field) rescue nil
|
69
69
|
|
70
70
|
return if resource_id_value.blank?
|
71
71
|
|
@@ -159,6 +159,11 @@ class TestActsAsSeoFriendly < Test::Unit::TestCase
|
|
159
159
|
assert_equal('a-1-5', e.seo_id, "seo_id unique counter should be +1 of and existing seo_id that matches the format with the minimum counter value")
|
160
160
|
end
|
161
161
|
|
162
|
+
def test_resource_method_model_using_a_method_as_a_resource_id
|
163
|
+
a = SeoTestResourceMethodModel.create!(:name => "a 1")
|
164
|
+
assert_equal('a-1', a.seo_id)
|
165
|
+
end
|
166
|
+
|
162
167
|
private
|
163
168
|
def create_seo_str(str)
|
164
169
|
SeoTestModel.new.send(:create_seo_friendly_str, str)
|
data/test/test_helper.rb
CHANGED
@@ -9,5 +9,6 @@ require File.dirname(__FILE__) + '/../lib/acts_as_seo_friendly'
|
|
9
9
|
require 'mocha'
|
10
10
|
require File.join(File.dirname(__FILE__), 'seo_test_model')
|
11
11
|
require File.join(File.dirname(__FILE__), 'seo_test_model_conditions')
|
12
|
+
require File.join(File.dirname(__FILE__), 'seo_test_resource_method_model')
|
12
13
|
|
13
14
|
|