Class: Views::Groups::Form

Inherits:
Base
  • Object
show all
Includes:
Phlex::Rails::Helpers::FormWith
Defined in:
app/views/groups/form.rb

Direct Known Subclasses

Edit, New

Instance Method Summary collapse

Constructor Details

#initialize(creator:, group:) ⇒ Form

Returns a new instance of Form.



6
7
8
9
# File 'app/views/groups/form.rb', line 6

def initialize(creator:, group:)
  @creator = creator
  @group = group
end

Instance Method Details

#before_template ⇒ Object



11
12
13
# File 'app/views/groups/form.rb', line 11

def before_template
  @group.memberships.build if @group.memberships.empty?
end

#view_template ⇒ Object



15
16
17
18
# File 'app/views/groups/form.rb', line 15

def view_template
  # Using an ERB form otherwise coccooned doesn't work
  render partial("form", creator: @creator, group: @group)
end