Class: Locomotive::Steam::ContentTypeRepository
- Inherits:
-
Object
- Object
- Locomotive::Steam::ContentTypeRepository
show all
- Includes:
- Models::Repository
- Defined in:
- lib/locomotive/steam/repositories/content_type_repository.rb
Instance Attribute Summary
#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 Method Details
#by_slug(slug_or_content_type) ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/locomotive/steam/repositories/content_type_repository.rb', line 13
def by_slug(slug_or_content_type)
if slug_or_content_type.is_a?(String)
query { where(slug: slug_or_content_type) }.first
else
slug_or_content_type
end
end
|
#fields_for(content_type) ⇒ Object
26
27
28
29
|
# File 'lib/locomotive/steam/repositories/content_type_repository.rb', line 26
def fields_for(content_type)
return nil if content_type.nil?
content_type.fields
end
|
#look_for_unique_fields(content_type) ⇒ Object
21
22
23
24
|
# File 'lib/locomotive/steam/repositories/content_type_repository.rb', line 21
def look_for_unique_fields(content_type)
return nil if content_type.nil?
content_type.fields.unique
end
|
#select_options(content_type, name) ⇒ Object
31
32
33
34
|
# File 'lib/locomotive/steam/repositories/content_type_repository.rb', line 31
def select_options(content_type, name)
return nil if content_type.nil? || name.nil?
content_type.fields.select_options(name.to_s)
end
|