module ProductHelperdef quantity(product)String.build do |s|s << product.quantity.to_ss << " "s << product.pluralize(product.quantity, product.name)s << " remaining."endenddef name(product)product.name.titleizeendend
name helper methods will only be accessible within the
ProductController class and any views rendered from that class.
The application helper works slightly differently. The application helper is included in the
ApplicationController is inherited from every new controller, every controller (and view) has access to helper methods defined in the application helper.
Methods should only be defined in this module if you want them accessible from all parts of your application.