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.
@@ -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[resource_id_field]
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revolutionhealth-acts_as_seo_friendly
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Revolution Health