Project

General

Profile

« Previous | Next » 

Revision 823d4e1b

Added by Joseph Magen over 10 years ago

fixes #3876 - API find_resource by name even if name starts with integer

View differences:

test/functional/api/v2/models_controller_test.rb
get :index, { :search => 'notarightterm = wrong' }
assert_response :bad_request
end
test "find model by name even if name starts with integer" do
model = models(:one)
new_model = as_admin { Model.create!(:name => "#{model.id}abcdef") }
assert_equal model.id, new_model.name.to_i
get :show, { :id => new_model.name }
assert assigns(:model).present?
assert_equal new_model.id, assigns(:model).id
end
end

Also available in: Unified diff