Sha256: 5a63de15a569554db649151964646de4775cf3c0b451ac313618b5311b52e0ff

Contents?: true

Size: 474 Bytes

Versions: 4

Compression:

Stored size: 474 Bytes

Contents

class Other < ActiveRecord::Base
	# rails g scaffold Other name:string permalink:string content:text

	validates :permalink, :route => { unreserved_routes: ["pages"] }

	validates_format_of :permalink, :without => /^\d/, :multiline => true
	
	def self.find(input)
		input.to_i == 0 ? find_by_permalink(input) : super(input)
	end

	def self.exists?(input)
		input.to_i == 0 ? super(permalink: input) : super(input)
	end

	def to_param  # overridden
		self.permalink
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
valid_route-0.0.4 test/dummy/app/models/other.rb
valid_route-0.0.3 test/dummy/app/models/other.rb
valid_route-0.0.2 test/dummy/app/models/other.rb
valid_route-0.0.1 test/dummy/app/models/other.rb