Reputation: 695
I create a simple module in ruby to implement on ActiveRecord model.
module Parameterize
def to_param
"#{ id } #{ name }".parameterize
end
end
The question it's where to place the file?
Upvotes: 0
Views: 109
Reputation: 27747
These generally are placed in a new directory off app
called concerns
- it's worth googling for more info about how that works.
here's a good ref of places to go look: How to use concerns in Rails 4
Upvotes: 3