class Object

Public Class Methods

from_param(value) click to toggle source
# File lib/param/core.rb, line 19
def from_param(value)
  if param_name.nil?
    find(value)
  else
    criteria = {}
    criteria[param_name] = value

    find_by(criteria)
  end
end
param(attribute, options = {}) click to toggle source
# File lib/param/core.rb, line 6
def param(attribute, options = {})
  @param = attribute
  @param_to_s = options[:to_s]

  alias_method :to_s, :to_param if options[:to_s] == true
end
param_name() click to toggle source
# File lib/param/core.rb, line 13
def param_name
  @param
end

Public Instance Methods

param_name() click to toggle source
# File lib/param/core.rb, line 41
def param_name
  self.class.param_name
end
to_param() click to toggle source
Calls superclass method
# File lib/param/core.rb, line 31
def to_param
  if param_name.nil?
    super
  else
    send(param_name)
  end
end