Thursday, October 15, 2009

can't convert Fixnum into String to_param

I was getting this error in to_param method. I had to explicity call to_s on id to fix it. My to_param method :

def to_param
name_slug ? "#{id.to_s}-#{name_slug.parameterize}" : id.to_s
end

If the name slug is not nil then it uses that to generate the SEO friendly URL otherwise it uses the id.

No comments:

Post a Comment