ActiveRecord::Integration::ClassMethods
module ActiveRecord::Integration::ClassMethods
Public Instance Methods
Defines your model's to_param
method to generate “pretty” URLs using method_name
, which can be any attribute or method that responds to to_s
.
class User < ActiveRecord::Base to_param :name end user = User.find_by(name: 'Fancy Pants') user.id # => 123 user_path(user) # => "/users/123-fancy-pants"
Values