Class: Faat::Generators::FormsGenerator

Inherits:
Base
  • Object
show all
Defined in:
lib/generators/faat/forms/forms_generator.rb

Instance Method Summary collapse

Methods inherited from Base

banner, source_root

Instance Method Details

#create_formObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/generators/faat/forms/forms_generator.rb', line 10

def create_form
  @form_attributes = []

  unless attr.size.zero?
    attr.each do |arg|
      if arg.include?(':')
        @form_attributes << Rails::Generators::GeneratedAttribute.new(*arg.split(':'))
      else
        @form_attributes << Rails::Generators::GeneratedAttribute.new(arg)
      end
    end
  end

  template "form_template.rb", "app/forms/#{file_name}_form.rb"
end