def create_or_show
@attributes = self.columns if @attributes.empty?
if options[:partial]
empty_directory "app/views/#{controller_path}"
template "_form.html.#{template_type}", "app/views/#{controller_path}/_form.html.#{template_type}"
else
template = File.read("#{self.class.source_root}/_form.html.#{template_type}")
erb = ERB.new(template, nil, '-')
generated_code = erb.result(binding).strip rescue nil
puts "# ---------------------------------------------------------"
puts "# GENERATED FORMTASTIC CODE"
puts "# ---------------------------------------------------------"
puts
puts generated_code || "Nothing could be generated - model exists?"
puts
puts "# ---------------------------------------------------------"
puts "Copied to clipboard - just paste it!" if save_to_clipboard(generated_code)
end
end