class Faat::Generators::FormsGenerator

Public Instance Methods

create_form() click to toggle source
# 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

Private Instance Methods

attributes() click to toggle source
# File lib/generators/faat/forms/forms_generator.rb, line 28
def attributes
  @form_attributes
end
class_name() click to toggle source
# File lib/generators/faat/forms/forms_generator.rb, line 36
def class_name
  form_name.downcase.capitalize
end
file_name() click to toggle source
# File lib/generators/faat/forms/forms_generator.rb, line 32
def file_name
  form_name.underscore
end