Franz Strebel wrote:
> On Mon, Dec 8, 2008 at 1:55 PM, Dave Smith
> <[EMAIL PROTECTED]> wrote:
>>
>> http://localhost:3000/services/clothes/articles
>
> Assuming that the attribute of the Service is called name,
> you should define this in your Service model:
>
> def to_param
> name
> end
>
> for more info, look at this post:
>
> http://www.jroller.com/obie/entry/seo_optimization_of_urls_in
I used the following code in the end, as I have a field title in the
table.
def to_param
id.to_s+'-'+title.downcase.gsub(' ', '-')
end
However it puts the address with the ID at the beginning;
http://localhost:3000/services/1-horse-&-groom/articles
Is there a way I can remove this from the address to tidy it up a bit?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---