You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have a ActiveRecord model, which overrides to_param and from_param
but ActiveRecord#find does not use from_param.
to_param needs the id to be appended to it, for AR#find to work
find(123-hello)is equal find(123)because 123-hello is typecastedto the type of colum in this case the ìd that is an integer, infact "123-hello".to_i == 1234
Anyway this is not a issue, if you have any new proposals you can send an email or post a message to rails core team google group
Yeah, @acapilleri got it right. When using some sort of slug that starts with id, that works out of the box because of typecasting, and find will always receive an id - or array of ids.
from_param does not exist in Active Record, the tip existent in apidock is solely to keep methods in sync in your app, so you have a single finder to use wherever needed, but AR has no knowledge of it.
Have a ActiveRecord model, which overrides to_param and from_param
but ActiveRecord#find does not use from_param.
to_param needs the id to be appended to it, for AR#find to work
explained at http://apidock.com/rails/ActiveRecord/Base/to_param, by balint_erdi in the comments
example at: https://gist.github.com/3135755
The text was updated successfully, but these errors were encountered: