Class: Locomotive::Steam::ContentTypeFieldSelectOptionRepository
- Inherits:
-
Object
- Object
- Locomotive::Steam::ContentTypeFieldSelectOptionRepository
show all
- Includes:
- Models::Repository
- Defined in:
- lib/locomotive/steam/repositories/content_type_field_select_option_repository.rb
Instance Attribute Summary collapse
#adapter, #local_conditions, #scope
Instance Method Summary
collapse
#base_url, #build, #count, #create, #delete, #find, #first, #i18n_value_of, #inc, #initialize, #initialize_copy, #k, #last, #mapper, #prepare_conditions, #query, #update
Instance Attribute Details
#content_type_field ⇒ Object
Returns the value of attribute content_type_field.
8
9
10
|
# File 'lib/locomotive/steam/repositories/content_type_field_select_option_repository.rb', line 8
def content_type_field
@content_type_field
end
|
Instance Method Details
#all ⇒ Object
17
18
19
|
# File 'lib/locomotive/steam/repositories/content_type_field_select_option_repository.rb', line 17
def all
query { order_by(position: :asc) }.all
end
|
#by_id_or_name(id_or_name) ⇒ Object
27
28
29
|
# File 'lib/locomotive/steam/repositories/content_type_field_select_option_repository.rb', line 27
def by_id_or_name(id_or_name)
find(id_or_name) || by_name(id_or_name)
end
|
#by_name(name) ⇒ Object
21
22
23
24
25
|
# File 'lib/locomotive/steam/repositories/content_type_field_select_option_repository.rb', line 21
def by_name(name)
scope.with_locale(query_locale) do
query { where(name: name) }.first
end
end
|
#query_locale ⇒ Object
31
32
33
34
|
# File 'lib/locomotive/steam/repositories/content_type_field_select_option_repository.rb', line 31
def query_locale
content_type_field.localized? ? locale : scope.default_locale
end
|