Sha256: 429469fa70229a0f7d6d58ddf52b074832c140ff02bba8a887c0e3fb944349f0

Contents?: true

Size: 470 Bytes

Versions: 9

Compression:

Stored size: 470 Bytes

Contents

class SchofieldFormGenerator < FormGenerator
  
  protected
    
    def add_options!(opt)
      super
      opt.on('--parent PARENT_PATH',
        "Specify the parent for the specified model.") do |v|
        options[:parent] = v if v.present?
      end
    end
    
    def form_model
      array = [':admin']
      array << "@#{options[:parent]}" unless options[:parent].nil?
      array << "@#{singular_name.singularize}"
      "[#{array.join(', ')}]"
    end
  
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
schofield-0.1.1 generators/schofield_form/schofield_form_generator.rb
schofield-0.1.0 generators/schofield_form/schofield_form_generator.rb
schofield-0.0.11 generators/schofield_form/schofield_form_generator.rb
schofield-0.0.10 generators/schofield_form/schofield_form_generator.rb
schofield-0.0.9 generators/schofield_form/schofield_form_generator.rb
schofield-0.0.8 generators/schofield_form/schofield_form_generator.rb
schofield-0.0.7 generators/schofield_form/schofield_form_generator.rb
schofield-0.0.6 generators/schofield_form/schofield_form_generator.rb
schofield-0.0.5 generators/schofield_form/schofield_form_generator.rb