Class: WebammToRails::Sources::Models::AttachmentDefinition::Presenter

Inherits:
Object
  • Object
show all
Defined in:
lib/webamm_to_rails/sources/models/attachment_definition/presenter.rb

Instance Method Summary collapse

Constructor Details

#initialize(column:) ⇒ Presenter

Returns a new instance of Presenter.



6
7
8
# File 'lib/webamm_to_rails/sources/models/attachment_definition/presenter.rb', line 6

def initialize(column:)
  @column = column
end

Instance Method Details

#renderObject



10
11
12
13
14
15
16
# File 'lib/webamm_to_rails/sources/models/attachment_definition/presenter.rb', line 10

def render
  if @column.name == @column.name.pluralize
    "has_many_attached :#{@column.name}"
  else
    "has_one_attached :#{@column.name}"
  end
end