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

Using insert_at with values with type String #117

Closed
vietqhoang opened this issue Apr 22, 2014 · 2 comments
Closed

Using insert_at with values with type String #117

vietqhoang opened this issue Apr 22, 2014 · 2 comments

Comments

@vietqhoang
Copy link

  • Rails 4.0.4
  • Ruby 2.1.1
  • simple_form gem

For model Foo, inserting at say position utilizing strong parameters yields

> Foo.insert_at(foo_params[:position])
> ArgumentError: comparison of Fixnum with String failed

Parameters for my case are passed as String. To get it to insert, I must convert the parameter position to type Integer. I accomplished this in the foo_params method.

What's the feasibility of having the (String|Integer) => Integer conversion included in the insert_at method (and any other applicable method)?

@mcmegavolt
Copy link

👍

@brendon
Copy link
Owner

brendon commented Apr 17, 2016

It could be feasible but not something any of us have time to work on. If you can provide a PR we can look at it from there. I'll close this for now though. I think it's reasonable to expect the position to be provided as an integer and for your code to be doing the conversion first.

@brendon brendon closed this as completed Apr 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants