you could create a method called

def leading_zeros(number)
  "%05d" % number
end

and then call it

"#{leading_zeros order.id}#{order.name}"

What you have with ""#{order.id}".leading_zeros

is that #{order.id} will evaluate to a string and then you are trying to
call the leading_zeros method on the string. For it to work as you intend
leading_zeros needs to be part of the String class.

There is no end of pain in doing this.

Just save leading_zeros as a helper method in the application helps and call
it as I have shown.

-- 
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.

Reply via email to