How to avoid displaying: id in url while editing

I am using like

def to_param
"#{self.attr1}-#{self.attr2}"
end

      

and my urls look the way i want, although when i: edit (edit) redirects the url / returns to showing: id.

I allow guest users to modify any particular record without registering when submitting them from a specific link, and I want to prevent users from manually changing the url, or at least showing them a large pool so they can't guess the id ...

Thanks in advance for any help, you have a lot of posts about this but can't find a solution that suits my needs.

+3


source to share


1 answer


credit @Dipak for pointing me in the right direction.

I was able to do this with the Friendly_ID pearl, although it gave me some problem because I had some pre-action redirects and didn't want to pick up the bullets.

I had my redirects as 'redirect_to mymodel_path'



I finally got it working "redirect_to mymodel_path (mymodel)"

Thank!

+2


source







All Articles