Class: Baza::DatabaseModelName
- Inherits:
-
Object
- Object
- Baza::DatabaseModelName
- Defined in:
- lib/baza/database_model_name.rb
Overview
Used for link-methods in Rails apps
Instance Method Summary collapse
- #human ⇒ Object
-
#initialize(instance) ⇒ DatabaseModelName
constructor
A new instance of DatabaseModelName.
- #singular_route_key ⇒ Object
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
#human ⇒ Object
13 14 15 |
# File 'lib/baza/database_model_name.rb', line 13 def human @instance.class.name.split("::").last end |
#singular_route_key ⇒ Object
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 |