Sha256: 7ba38179ca66cab9e0ebd127c222c92e19b1dba52e5fc2b8bd4176f12a5aa796

Contents?: true

Size: 429 Bytes

Versions: 12

Compression:

Stored size: 429 Bytes

Contents

class GroupForm < Kadmin::Form
  delegate_attributes :name, owner_id: [:reader]
  delegate_association :owner, to: 'PersonForm'

  def initialize(*args)
    super
    raise(ArgumentError, 'Model given should be a group') unless @model.nil? || @model.is_a?(Group)
  end

  def owner_id=(id)
    @model.owner_id = id.to_i
  end

  def owner_attributes=(attributes)
    form = owner
    form.assign_attributes(attributes)
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
kadmin-0.6.8 test/dummy/app/forms/group_form.rb
kadmin-0.6.7 test/dummy/app/forms/group_form.rb
kadmin-0.6.6 test/dummy/app/forms/group_form.rb
kadmin-0.6.5 test/dummy/app/forms/group_form.rb
kadmin-0.6.4 test/dummy/app/forms/group_form.rb
kadmin-0.6.3 test/dummy/app/forms/group_form.rb
kadmin-0.6.1 test/dummy/app/forms/group_form.rb
kadmin-0.5.7 test/dummy/app/forms/group_form.rb
kadmin-0.5.6 test/dummy/app/forms/group_form.rb
kadmin-0.4.2 test/dummy/app/forms/group_form.rb
kadmin-0.4.1 test/dummy/app/forms/group_form.rb
kadmin-0.4.0 test/dummy/app/forms/group_form.rb