Module: Phlexi::Field

Defined in:
lib/phlexi/field.rb,
lib/phlexi/field/theme.rb,
lib/phlexi/field/builder.rb,
lib/phlexi/field/version.rb,
lib/phlexi/field/options/hints.rb,
lib/phlexi/field/structure/dom.rb,
lib/phlexi/field/support/value.rb,
lib/phlexi/field/options/labels.rb,
lib/phlexi/field/structure/node.rb,
lib/phlexi/field/components/base.rb,
lib/phlexi/field/options/multiple.rb,
lib/phlexi/field/options/validators.rb,
lib/phlexi/field/options/attachments.rb,
lib/phlexi/field/structure/namespace.rb,
lib/phlexi/field/options/associations.rb,
lib/phlexi/field/options/descriptions.rb,
lib/phlexi/field/options/placeholders.rb,
lib/phlexi/field/options/inferred_types.rb,
lib/phlexi/field/structure/field_collection.rb,
lib/phlexi/field/structure/namespace_collection.rb

Defined Under Namespace

Modules: Components, Options, Structure, Support Classes: Builder, Error, Theme

Constant Summary collapse

Loader =
Zeitwerk::Loader.new.tap do |loader|
  loader.tag = File.basename(__FILE__, ".rb")
  loader.ignore("#{__dir__}/field/version.rb")
  loader.inflector.inflect(
    "phlexi-field" => "Phlexi",
    "phlexi" => "Phlexi",
    "dom" => "DOM"
  )
  loader.push_dir(File.expand_path("..", __dir__))
  loader.setup
end
COMPONENT_BASE =
(::ApplicationComponent) ? ::ApplicationComponent : Phlex::HTML)
VERSION =
"0.0.9"

Class Method Summary collapse

Class Method Details

.object_primary_key(object) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/phlexi/field.rb', line 27

def self.object_primary_key(object)
  if object.class.respond_to?(:primary_key)
    object.send(object.class.primary_key.to_sym)
  elsif object.respond_to?(:id)
    object.id
  end
end