find method doesn't care about the to_param method, it just takes the
parameter you use, I guess it calls "to_i" and uses that integer to query
the id column

Why don't you show your code, the stacktrace, the logs or anything? I
suggest you read something like stackoverflow's guidelines on how to ask,
you posts are usually really hard to understand and a lot of information is
missing

El mié., 15 ene. 2020 a las 18:01, fugee ohu (<fugee...@gmail.com>)
escribió:

>
>
> On Wednesday, January 15, 2020 at 3:07:00 PM UTC-5, Ariel Juodziukynas
> wrote:
>>
>> From the docs:
>> https://apidock.com/rails/v6.0.0/ActiveRecord/FinderMethods/find
>>
>> Person <https://apidock.com/rails/Person>.find 
>> <https://apidock.com/rails/ActiveRecord/FinderMethods/find>("31-sarah") # 
>> returns the object for ID = 31
>>
>> In your case, if you are using find, it should search for record with id
>> = 18
>>
>> El mié., 15 ene. 2020 a las 16:18, fugee ohu (<fuge...@gmail.com>)
>> escribió:
>>
>>> Doesn't work for me in rails 6
>>>
>>>   Parameters: {"id"=>"18-test-title"}
>>>  ActionController::ActionControllerError (Cannot redirect to nil!):
>>>
>>> Ne
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Ruby on Rails: Talk" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to rubyonra...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/rubyonrails-talk/64e66550-c393-43cd-8156-29c43139899a%40googlegroups.com
>>> <https://groups.google.com/d/msgid/rubyonrails-talk/64e66550-c393-43cd-8156-29c43139899a%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
> I've over-riding ActiveRecord to_param in my model
>
>   def to_param
>    "#{id}-#{title.parameterize}"
>   end
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-talk+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/1ba590e7-4c1c-4fcd-9ed8-0f2ed65b0350%40googlegroups.com
> <https://groups.google.com/d/msgid/rubyonrails-talk/1ba590e7-4c1c-4fcd-9ed8-0f2ed65b0350%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAPS3bcDQU%2BQLcCOftreFJb0UdUFYUYPAFM%3DCm1xCO2qomsQ6Ag%40mail.gmail.com.

Reply via email to