module Conversions
Rails-specific stuff
Mimics ActiveModell::conversions
Public Instance Methods
to_key()
click to toggle source
Returns an Array
of all key attributes if any is set, regardless if the object is persisted or not. Returns nil if there are no key attributes.
# File lib/support/conversions.rb, line 12 def to_key key = respond_to?(:rid) && rid key ? [key] : nil end
to_param()
click to toggle source
Returns a string
representing the object's key suitable for use in URLs,
# or +nil+ if <tt>persisted?</tt> is +false+.
# File lib/support/conversions.rb, line 19 def to_param (persisted? && key = to_key) ? key.join('-') : nil end
to_partial_path()
click to toggle source
Returns a string
identifying the path associated with the object.
# ActionPack uses this to find a suitable partial to represent the object.
# File lib/support/conversions.rb, line 26 def to_partial_path self.class._to_partial_path end