Class: TagGroup::FormObject

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
app/models/tag_group/form_object.rb

Overview

This form object class handles the user interaction for creating new Tag Groups. It sensibility checks the user-entered list of Tag oligo sequences before creating the Tag Group and Tags.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#adapter_type_idObject

Attributes



11
12
13
# File 'app/models/tag_group/form_object.rb', line 11

def adapter_type_id
  @adapter_type_id
end

#nameObject

Attributes



11
12
13
# File 'app/models/tag_group/form_object.rb', line 11

def name
  @name
end

#oligos_textObject

Attributes



11
12
13
# File 'app/models/tag_group/form_object.rb', line 11

def oligos_text
  @oligos_text
end

#tag_groupObject (readonly)

Access the tag group record after it’s saved



14
15
16
# File 'app/models/tag_group/form_object.rb', line 14

def tag_group
  @tag_group
end

Class Method Details

.model_nameObject

form builder methods (e.g. form_to) need the Active Model name to be set



32
33
34
# File 'app/models/tag_group/form_object.rb', line 32

def self.model_name
  ActiveModel::Name.new(TagGroup)
end

Instance Method Details

#saveObject



21
22
23
24
25
26
27
28
29
# File 'app/models/tag_group/form_object.rb', line 21

def save
  if valid?
    persist!
    true
  else
    errors.add(:oligos_text, I18n.t('tag_groups.errors.tag_group_form_invalid'))
    false
  end
end