Sha256: 3607bc0d5b1c3ebf405e630665188f601a739b8de877a008c6bd98199fa5e98a

Contents?: true

Size: 697 Bytes

Versions: 1

Compression:

Stored size: 697 Bytes

Contents

class MainModelModel
  include TransForms::MainModel
end

class ProxyModel
  include TransForms::MainModel::Proxy
  self.main_model = :user
end

class UserUpdater < TransForms::FormBase
  set_main_model :user

  attribute :name,  String

  validates :name, presence: true

  transaction do
    user.attributes = { name: name }
    user.save!
  end

end

class UserProxyModel < TransForms::FormBase
  set_main_model :user, proxy: true
end

class UserProxyAllModel < TransForms::FormBase
  ATTR_ARG = :all
  set_main_model :user, proxy: { attributes: ATTR_ARG }
end

class UserProxySelectModel < TransForms::FormBase
  ATTR_ARG = %w(name)
  set_main_model :user, proxy: { attributes: ATTR_ARG }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trans_forms-0.2.0 spec/support/trans_forms/main_model_forms.rb