In some book, it is recommended that to_param is changed to
class Story < ActiveRecord::Base
so that the URL is
so that the URL is more search engine friendly.
So probably to_param() doesn't need to be used by other parts of Rails
that changing it may have any side effect? Or maybe the only purpose is
to construct a URL for linking?
Another thing is, won't it require to limit the URL size to be less than
2k in length -- will it choke IE if it is more than 2k or maybe the part
more than 2k is just ignored by IE and so the URL still works. It might
be better to be limited to 30 or 40 characters or something that will
make the URL not exceedingly long.
Also, the `ri` doc of to_param:
class User < ActiveRecord::Base
def to_param # overridden
if to_param is changed like that, then the link actually won't work, as
will work, but
will not work as the ID is missing. Are there other ways to change the
**Update:** on second thought, maybe
won't work well if there are many webpages with similar title. but then
will work. Will it be params[:id] being "johnchan"? So then we will
user = User.find_by_login_name(params[:id])
to get the user. So it just depends on how we use the param on the URL.