Module: Perpetuity::RailsModel::ActiveModelish

Defined in:
lib/perpetuity/rails_model.rb

Instance Method Summary collapse

Instance Method Details

#model_nameObject



20
21
22
# File 'lib/perpetuity/rails_model.rb', line 20

def model_name
  self
end

#param_keyObject



24
25
26
# File 'lib/perpetuity/rails_model.rb', line 24

def param_key
  self.to_s.downcase.gsub('::', '_')
end

#route_keyObject



28
29
30
31
32
33
34
# File 'lib/perpetuity/rails_model.rb', line 28

def route_key
  if defined? ActiveSupport::Inflector
    ActiveSupport::Inflector.pluralize(param_key)
  else
    param_key + 's'
  end
end

#singular_route_keyObject



36
37
38
# File 'lib/perpetuity/rails_model.rb', line 36

def singular_route_key
  param_key
end