Class: Tramway::Core::ApplicationRecord
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Tramway::Core::ApplicationRecord
- Extended by:
- Enumerize
- Includes:
- PgSearch::Model
- Defined in:
- app/models/tramway/core/application_record.rb
Class Method Summary collapse
- .human_attribute_name(attribute_name, *_args) ⇒ Object
- .search_by(*attributes, **associations) ⇒ Object
Instance Method Summary collapse
- #creator ⇒ Object
-
#human_state_name ⇒ Object
FIXME: detect inhertited locales.
Class Method Details
.human_attribute_name(attribute_name, *_args) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'app/models/tramway/core/application_record.rb', line 33 def human_attribute_name(attribute_name, *_args) excepted_attributes = %w[created_at updated_at state] if attribute_name.to_s.in? excepted_attributes I18n.t "activerecord.attributes.tramway/core/application_record.#{attribute_name}" else super attribute_name end end |
.search_by(*attributes, **associations) ⇒ Object
42 43 44 |
# File 'app/models/tramway/core/application_record.rb', line 42 def search_by(*attributes, **associations) pg_search_scope :full_text_search, against: attributes, associated_against: associations end |
Instance Method Details
#creator ⇒ Object
27 28 29 |
# File 'app/models/tramway/core/application_record.rb', line 27 def creator audits.where(action: :create).first.user end |
#human_state_name ⇒ Object
FIXME: detect inhertited locales
48 49 50 |
# File 'app/models/tramway/core/application_record.rb', line 48 def human_state_name I18n.t "activerecord.state_machines.tramway/core/application_record.state.states.#{state}" end |