Class: RiddlerAdmin::Step

Inherits:
ApplicationRecord show all
Defined in:
app/models/riddler_admin/step.rb

Direct Known Subclasses

RiddlerAdmin::Steps::Content

Constant Summary collapse

MODEL_KEY =
"st".freeze
ID_LENGTH =

916_132_832 per second

5

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_classObject



6
7
8
# File 'app/models/riddler_admin/step.rb', line 6

def self.default_class
  Steps::Content
end

Instance Method Details

#definition_hash(options = nil) ⇒ Object



19
20
21
22
# File 'app/models/riddler_admin/step.rb', line 19

def definition_hash options=nil
  options ||= {}
  serializable_hash options.merge(serializable_hash_options)
end

#excluded_attrsObject



31
32
33
# File 'app/models/riddler_admin/step.rb', line 31

def excluded_attrs
  [:created_at, :updated_at, :name]
end

#objectObject

Used in serialization



15
16
17
# File 'app/models/riddler_admin/step.rb', line 15

def object
  type.demodulize.underscore
end

#serializable_hash_optionsObject



24
25
26
27
28
29
# File 'app/models/riddler_admin/step.rb', line 24

def serializable_hash_options
  {
    methods: :object,
    except: excluded_attrs
  }
end

#to_partial_path(detail = nil) ⇒ Object



10
11
12
# File 'app/models/riddler_admin/step.rb', line 10

def to_partial_path detail=nil
  [self.class.name.underscore, detail].compact.join "/"
end