Sha256: f3d705e7cadc2ff7f01cf7074d5b919e115d00783c998d40f87550d3c7392b98
Contents?: true
Size: 543 Bytes
Versions: 4
Compression:
Stored size: 543 Bytes
Contents
class User < ActiveRecord::Base # rails g scaffold User username:string password:string first_name:string slug:string # extend FriendlyId # friendly_id :username #, use: :slugged validates :username, :route => {reserved_routes: ["about", "admin"]} validates_format_of :username, :without => /^\d/, :multiline => true def self.find(input) input.to_i == 0 ? find_by_username(input) : super(input) end def self.exists?(input) input.to_i == 0 ? super(username: input) : super(input) end def to_param self.username end end
Version data entries
4 entries across 4 versions & 1 rubygems