Class: Baza::DatabaseModelName

Inherits:
Object
  • Object
show all
Defined in:
lib/baza/database_model_name.rb

Overview

Used for link-methods in Rails apps

Instance Method Summary collapse

Constructor Details

#initialize(instance) ⇒ DatabaseModelName

Returns a new instance of DatabaseModelName.



3
4
5
# File 'lib/baza/database_model_name.rb', line 3

def initialize(instance)
  @instance = instance
end

Instance Method Details

#humanObject



13
14
15
# File 'lib/baza/database_model_name.rb', line 13

def human
  @instance.class.name.split("::").last
end

#singular_route_keyObject



7
8
9
10
11
# File 'lib/baza/database_model_name.rb', line 7

def singular_route_key
  route_key = human.underscore
  route_key = "indexes" if route_key == "indices"
  route_key
end