Sha256: 60978448c1f06faefec9ca6135512c276342804486387d6993441230739d432d
Contents?: true
Size: 786 Bytes
Versions: 2
Compression:
Stored size: 786 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 transaction do # Will raise error if User model is not valid user.save! end 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
trans_forms-0.2.2 | spec/support/trans_forms/main_model_forms.rb |
trans_forms-0.2.1 | spec/support/trans_forms/main_model_forms.rb |