Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for issue #556 #557

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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