Skip to content

Commit

Permalink
fix for issue #556
Browse files Browse the repository at this point in the history
  • Loading branch information
andriytyurnikov committed May 26, 2014
1 parent 57baa35 commit dbdb7f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/friendly_id/base.rb
Expand Up @@ -222,7 +222,7 @@ def friendly_id_config
end

def primary_key_type
@primary_key_type ||= columns.find(&:primary).type
@primary_key_type ||= columns.find { |c| c.name == primary_key}.type
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/slugged_test.rb
Expand Up @@ -265,7 +265,7 @@ def model_class

test "should have a string as a primary key" do
assert_equal model_class.primary_key, "string_key"
assert_equal model_class.columns.find(&:primary).name, "string_key"
assert_equal model_class.columns.find { |c| c.name == model_class.primary_key}.name, "string_key"
end

test "should be findable by the string primary key" do
Expand Down

0 comments on commit dbdb7f6

Please sign in to comment.