Sha256: 3e25a667ea437d1d7ae4eb3a42ef81818d4fe69f212b32cf7fa424c61113b40a

Contents?: true

Size: 406 Bytes

Versions: 13

Compression:

Stored size: 406 Bytes

Contents

class SingleAssetModelForm
  include ActiveModel::Model
  include Tessa::Model

  ATTRIBUTES = %w[
    title
    avatar_id
  ]

  attr_accessor :single_asset_model
  attr_accessor *ATTRIBUTES

  asset :avatar

  def self.from_single_asset_model(model, attrs = {})
    new(
      model.attributes
        .slice(*ATTRIBUTES)
        .merge(attrs)
        .merge(single_asset_model: model) 
    )
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
tessa-1.2.3 spec/dummy/app/models/single_asset_model_form.rb
tessa-1.2.2 spec/dummy/app/models/single_asset_model_form.rb
tessa-2.0 spec/dummy/app/models/single_asset_model_form.rb
tessa-1.2.1 spec/dummy/app/models/single_asset_model_form.rb
tessa-1.2.0 spec/dummy/app/models/single_asset_model_form.rb
tessa-1.1.1 spec/dummy/app/models/single_asset_model_form.rb
tessa-1.1.0 spec/dummy/app/models/single_asset_model_form.rb
tessa-1.0.2 spec/dummy/app/models/single_asset_model_form.rb
tessa-1.0.1 spec/dummy/app/models/single_asset_model_form.rb
tessa-1.0.0 spec/dummy/app/models/single_asset_model_form.rb
tessa-1.0.0.pre.rc3 spec/dummy/app/models/single_asset_model_form.rb
tessa-1.0.0.pre.rc2 spec/dummy/app/models/single_asset_model_form.rb
tessa-1.0.0.pre.rc1 spec/dummy/app/models/single_asset_model_form.rb