class Locomotive::Steam::ContentTypeFieldRepository
Attributes
content_type[RW]
Public Instance Methods
associations()
click to toggle source
# File lib/locomotive/steam/repositories/content_type_field_repository.rb, line 45 def associations query { where(k(:type, :in) => %i(belongs_to has_many many_to_many)) }.all end
belongs_to()
click to toggle source
# File lib/locomotive/steam/repositories/content_type_field_repository.rb, line 37 def belongs_to query { where(type: :belongs_to) }.all end
by_name(name)
click to toggle source
# File lib/locomotive/steam/repositories/content_type_field_repository.rb, line 17 def by_name(name) first { where(name: name) } end
dates_and_date_times()
click to toggle source
# File lib/locomotive/steam/repositories/content_type_field_repository.rb, line 33 def dates_and_date_times query { where(k(:type, :in) => %i(date date_time)) }.all end
default()
click to toggle source
# File lib/locomotive/steam/repositories/content_type_field_repository.rb, line 70 def default query { where(k(:default, :neq) => nil, k(:type, :in) => [:string, :text, :color, :select, :boolean, :email, :integer, :float]) }.all end
files()
click to toggle source
# File lib/locomotive/steam/repositories/content_type_field_repository.rb, line 25 def files query { where(type: :file) }.all end
localized_names(include_select_field_id: true)
click to toggle source
# File lib/locomotive/steam/repositories/content_type_field_repository.rb, line 64 def localized_names(include_select_field_id: true) query { where(localized: true) }.all.map do |field| field.type == :select && include_select_field_id ? [field.name, "#{field.name}_id"] : field.name end.flatten end
many_to_many()
click to toggle source
# File lib/locomotive/steam/repositories/content_type_field_repository.rb, line 41 def many_to_many query { where(type: :many_to_many) }.all end
no_associations()
click to toggle source
# File lib/locomotive/steam/repositories/content_type_field_repository.rb, line 49 def no_associations query { where(k(:type, :nin) => %i(belongs_to has_many many_to_many)) }.all end
passwords()
click to toggle source
# File lib/locomotive/steam/repositories/content_type_field_repository.rb, line 29 def passwords query { where(type: :password) }.all end
required()
click to toggle source
# File lib/locomotive/steam/repositories/content_type_field_repository.rb, line 60 def required query { where(required: true) }.all end
select_options(name)
click to toggle source
# File lib/locomotive/steam/repositories/content_type_field_repository.rb, line 74 def select_options(name) if field = first { where(name: name, type: :select) } field.select_options.all else nil end end
selects()
click to toggle source
# File lib/locomotive/steam/repositories/content_type_field_repository.rb, line 21 def selects query { where(type: :select) }.all end
unique()
click to toggle source
# File lib/locomotive/steam/repositories/content_type_field_repository.rb, line 53 def unique query { where(unique: true) }.all.inject({}) do |memo, field| memo[field.name] = field memo end end