hot-glue 0.5.9.1 → 0.5.9.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,24 +1,19 @@
1
1
  require 'rails/generators/erb/scaffold/scaffold_generator'
2
2
  require 'ffaker'
3
-
3
+ require_relative './fields/field'
4
+ require_relative './field_factory'
4
5
  require_relative './markup_templates/base'
5
6
  require_relative './markup_templates/erb'
6
- # require_relative './markup_templates/haml'
7
- # require_relative './markup_templates/slim'
8
-
9
7
  require_relative './layout/builder'
10
8
  require_relative './layout_strategy/base'
11
9
  require_relative './layout_strategy/bootstrap'
12
10
  require_relative './layout_strategy/hot_glue'
13
11
  require_relative './layout_strategy/tailwind'
14
12
 
15
-
16
13
  module HotGlue
17
14
  class Error < StandardError
18
15
  end
19
16
 
20
-
21
-
22
17
  def self.construct_downnest_object(input)
23
18
  res = input.split(",").map { |child|
24
19
  child_name = child.gsub("+","")
@@ -95,8 +90,9 @@ module HotGlue
95
90
  hook_for :form_builder, :as => :scaffold
96
91
 
97
92
  source_root File.expand_path('templates', __dir__)
98
- attr_accessor :path, :singular, :plural, :singular_class, :nest_with
99
- attr_accessor :columns, :downnest_children, :layout_object
93
+ attr_accessor :path, :singular, :plural, :singular_class, :nest_with,
94
+ :columns, :downnest_children, :layout_object, :alt_lookups,
95
+ :update_show_only, :hawk_keys, :auth, :sample_file_path
100
96
 
101
97
  class_option :singular, type: :string, default: nil
102
98
  class_option :plural, type: :string, default: nil
@@ -180,11 +176,6 @@ module HotGlue
180
176
 
181
177
  if @stimulus_syntax.nil?
182
178
  @stimulus_syntax = true
183
-
184
- # if Rails.version.split(".")[0].to_i >= 7
185
- # @stimulus_syntax = true
186
- # else
187
- # end
188
179
  end
189
180
 
190
181
  if !options['markup'].nil?
@@ -194,6 +185,7 @@ module HotGlue
194
185
 
195
186
  yaml_from_config = YAML.load(File.read("config/hot_glue.yml"))
196
187
  @markup = yaml_from_config[:markup]
188
+ @sample_file_path = yaml_from_config[:sample_file_path]
197
189
 
198
190
  if options['layout']
199
191
  layout = options['layout']
@@ -454,12 +446,7 @@ module HotGlue
454
446
 
455
447
 
456
448
  @factory_creation = options['factory_creation'].gsub(";", "\n")
457
-
458
449
  identify_object_owner
459
-
460
-
461
-
462
- # SETUP FIELDS & LAYOUT
463
450
  setup_fields
464
451
 
465
452
  if (@columns - @show_only - (@ownership_field ? [@ownership_field.to_sym] : [])).empty?
@@ -481,34 +468,10 @@ module HotGlue
481
468
  @menu_file_exists = true if @nested_set.none? && File.exist?("#{Rails.root}/app/views/#{namespace_with_trailing_dash}_menu.#{@markup}")
482
469
 
483
470
  @turbo_streams = !!options['with_turbo_streams']
484
-
485
-
486
-
487
-
488
-
489
-
490
- end
491
-
492
-
493
- def fields_filtered_for_email_lookups
494
- @columns.reject{|c| @alt_lookups.keys.include?(c) } + @alt_lookups.values.map{|v| ("__lookup_#{v[:lookup_as]}").to_sym}
495
471
  end
496
472
 
497
473
 
498
- def creation_syntax
499
474
 
500
- merge_with = @alt_lookups.collect{ |key, data|
501
- "#{data[:assoc].downcase}: #{data[:assoc].downcase}_factory.#{data[:assoc].downcase}"
502
- }.join(", ")
503
-
504
- if @factory_creation == ''
505
- "@#{singular_name } = #{ class_name }.create(modified_params)"
506
- else
507
- "#{@factory_creation}\n" +
508
- " @#{singular_name } = #{ class_name }.create(modified_params#{'.merge(' + merge_with + ')' if !merge_with.empty?})"
509
- end
510
- end
511
-
512
475
  def setup_hawk_keys
513
476
  @hawk_keys = {}
514
477
 
@@ -655,7 +618,6 @@ module HotGlue
655
618
  end
656
619
 
657
620
  def setup_fields
658
-
659
621
  if !@include_fields
660
622
  @exclude_fields.push :id, :created_at, :updated_at, :encrypted_password,
661
623
  :reset_password_token,
@@ -678,64 +640,76 @@ module HotGlue
678
640
  @attachments.keys.each do |attachment|
679
641
  @columns << attachment if !@columns.include?(attachment)
680
642
  end
681
- end
682
643
 
644
+ check_if_sample_file_is_present
645
+ end
683
646
 
684
647
 
648
+ # build a new polymorphic object
685
649
  @associations = []
686
-
650
+ @columns_map = {}
687
651
  @columns.each do |col|
652
+ if !(@the_object.columns_hash.keys.include?(col.to_s) || @attachments.keys.include?(col))
653
+ raise "couldn't find #{col} in either field list or attachments list"
654
+ end
655
+
688
656
  if col.to_s.starts_with?("_")
689
657
  @show_only << col
690
658
  end
691
659
 
692
660
  if @the_object.columns_hash.keys.include?(col.to_s)
693
- if @the_object.columns_hash[col.to_s].type == :integer
694
- if col.to_s.ends_with?("_id")
695
- # guess the association name label
696
- assoc_name = col.to_s.gsub("_id","")
661
+ type = @the_object.columns_hash[col.to_s].type
662
+ elsif @attachments.keys.include?(col)
663
+ type = :attachment
664
+ end
665
+ this_column_object = FieldFactory.new(name: col.to_s,
666
+ generator: self,
667
+ type: type)
668
+ field = this_column_object.field
669
+ if field.is_a?(AssociationField)
670
+ @associations << field.assoc_name.to_sym
671
+ end
672
+ @columns_map[col] = this_column_object.field
697
673
 
698
674
 
699
- assoc_model = eval("#{singular_class}.reflect_on_association(:#{assoc_name})")
700
675
 
701
- if assoc_model.nil?
702
- exit_message = "*** Oops: The model #{singular_class} is missing an association for :#{assoc_name} or the model #{assoc_name.titlecase} doesn't exist. TODO: Please implement a model for #{assoc_name.titlecase}; or add to #{singular_class} `belongs_to :#{assoc_name}`. To make a controller that can read all records, specify with --god."
703
- puts exit_message
704
- raise(HotGlue::Error, exit_message)
705
- end
676
+ end
677
+ end
706
678
 
707
- begin
708
- assoc_class = eval(assoc_model.try(:class_name))
709
- @associations << assoc_name.to_sym
710
- name_list = [:name, :to_label, :full_name, :display_name, :email]
711
-
712
- rescue
713
- # unreachable(?)
714
- # if eval("#{singular_class}.reflect_on_association(:#{assoc_name.singularize})")
715
- # raise(HotGlue::Error,"*** Oops: #{singular_class} has no association for #{assoc_name.singularize}")
716
- # else
717
- # raise(HotGlue::Error,"*** Oops: Missing relationship from class #{singular_class} to :#{@object_owner_sym} maybe add `belongs_to :#{@object_owner_sym}` to #{singular_class}\n (If your user is called something else, pass with flag auth=current_X where X is the model for your auth object as lowercase. Also, be sure to implement current_X as a method on your controller. If you really don't want to implement a current_X on your controller and want me to check some other method for your current user, see the section in the docs for --auth-identifier flag). To make a controller that can read all records, specify with --god.")
718
- # end
719
- end
720
679
 
721
- if assoc_class && name_list.collect{ |field|
722
- assoc_class.respond_to?(field.to_s) || assoc_class.instance_methods.include?(field)
723
- }.any?
724
- # do nothing here
725
- else
726
- exit_message = "Oops: Missing a label for `#{assoc_class}`. Can't find any column to use as the display label for the #{assoc_name} association on the #{singular_class} model. TODO: Please implement just one of: 1) name, 2) to_label, 3) full_name, 4) display_name 5) email. You can implement any of these directly on your`#{assoc_class}` model (can be database fields or model methods) or alias them to field you want to use as your display label. Then RERUN THIS GENERATOR. (Field used will be chosen based on rank here.)"
727
- raise(HotGlue::Error,exit_message)
728
- end
729
- end
730
- end
731
- elsif @attachments.keys.include?(col)
680
+ def check_if_sample_file_is_present
681
+ if sample_file_path.nil?
682
+ puts "you have no sample file path set in config/hot_glue.yml"
683
+ settings = File.read("config/hot_glue.yml")
684
+ @sample_file_path = "spec/files/computer_code.jpg"
685
+ added_setting = ":sample_file_path: #{sample_file_path}"
686
+ File.open("config/hot_glue.yml", "w") { |f| f.write settings + "\n" + added_setting }
732
687
 
733
- else
734
- raise "couldn't find #{col} in either field list or attachments list"
735
- end
688
+ puts "adding `#{added_setting}` to config/hot_glue.yml"
689
+ elsif ! File.exist?(sample_file_path)
690
+ puts "NO SAMPLE FILE FOUND: adding sample file at #{sample_file_path}"
691
+ template "computer_code.jpg", File.join("#{filepath_prefix}spec/files/", "computer_code.jpg")
736
692
  end
693
+
694
+ puts ""
695
+ end
696
+
697
+ def fields_filtered_for_email_lookups
698
+ @columns.reject{|c| @alt_lookups.keys.include?(c) } + @alt_lookups.values.map{|v| ("__lookup_#{v[:lookup_as]}").to_sym}
737
699
  end
738
700
 
701
+ def creation_syntax
702
+ merge_with = @alt_lookups.collect{ |key, data|
703
+ "#{data[:assoc].downcase}: #{data[:assoc].downcase}_factory.#{data[:assoc].downcase}"
704
+ }.join(", ")
705
+
706
+ if @factory_creation == ''
707
+ "@#{singular } = #{ class_name }.create(modified_params)"
708
+ else
709
+ "#{@factory_creation}\n" +
710
+ " @#{singular } = #{ class_name }.create(modified_params#{'.merge(' + merge_with + ')' if !merge_with.empty?})"
711
+ end
712
+ end
739
713
 
740
714
  def auth_root
741
715
  "authenticate_" + @auth_identifier.split(".")[0] + "!"
@@ -749,22 +723,25 @@ module HotGlue
749
723
  nil
750
724
  end
751
725
 
726
+ def filepath_prefix
727
+ 'spec/dummy/' if Rails.env.test?
728
+ end
729
+
752
730
  def copy_controller_and_spec_files
753
731
  @default_colspan = @columns.size
754
732
  unless @specs_only
755
- template "controller.rb.erb", File.join("#{'spec/dummy/' if Rails.env.test?}app/controllers#{namespace_with_dash}", "#{@controller_build_folder}_controller.rb")
733
+ template "controller.rb.erb", File.join("#{filepath_prefix}app/controllers#{namespace_with_dash}", "#{@controller_build_folder}_controller.rb")
756
734
  if @namespace
757
735
  begin
758
736
  eval(controller_descends_from)
759
- # puts " skipping base controller #{controller_descends_from}"
760
737
  rescue NameError => e
761
- template "base_controller.rb.erb", File.join("#{'spec/dummy/' if Rails.env.test?}app/controllers#{namespace_with_dash}", "base_controller.rb")
738
+ template "base_controller.rb.erb", File.join("#{filepath_prefix}app/controllers#{namespace_with_dash}", "base_controller.rb")
762
739
  end
763
740
  end
764
741
  end
765
742
 
766
743
  unless @no_specs
767
- dest_file = File.join("#{'spec/dummy/' if Rails.env.test?}spec/features#{namespace_with_dash}", "#{plural}_behavior_spec.rb")
744
+ dest_file = File.join("#{filepath_prefix}spec/features#{namespace_with_dash}", "#{plural}_behavior_spec.rb")
768
745
 
769
746
  if File.exist?(dest_file)
770
747
  existing_file = File.open(dest_file)
@@ -786,24 +763,21 @@ module HotGlue
786
763
  template "system_spec.rb.erb", dest_file
787
764
  end
788
765
 
789
- template "#{@markup}/_errors.#{@markup}", File.join("#{'spec/dummy/' if Rails.env.test?}app/views#{namespace_with_dash}", "_errors.#{@markup}")
766
+ template "#{@markup}/_errors.#{@markup}", File.join("#{filepath_prefix}app/views#{namespace_with_dash}", "_errors.#{@markup}")
790
767
  end
791
768
 
792
769
  def spec_foreign_association_merge_hash
793
770
  ", #{testing_name}: #{testing_name}1"
794
771
  end
795
772
 
773
+ def testing_name
774
+ singular_class.gsub("::","_").underscore
775
+ end
776
+
796
777
  def spec_related_column_lets
797
- (@columns - @show_only - @attachments.keys).map { |col|
798
- type = eval("#{singular_class}.columns_hash['#{col}']").type
799
- if (type == :integer && col.to_s.ends_with?("_id") || type == :uuid)
800
- assoc = "#{col.to_s.gsub('_id','')}"
801
- the_foreign_class = eval(@singular_class + ".reflect_on_association(:" + assoc + ")").class_name.split("::").last.underscore
802
- hawk_keys_on_lets = (@hawk_keys["#{assoc}_id".to_sym] ? ", #{@auth.gsub('current_', '')}: #{@auth}": "")
803
-
804
- " let!(:#{assoc}1) {create(:#{the_foreign_class}" + hawk_keys_on_lets + ")}"
805
- end
806
- }.compact.join("\n")
778
+ @columns_map.collect { |col, col_object|
779
+ col_object.spec_related_column_lets
780
+ }.join("\n")
807
781
  end
808
782
 
809
783
  def list_column_headings
@@ -816,23 +790,14 @@ module HotGlue
816
790
  end
817
791
 
818
792
  def columns_spec_with_sample_data
819
- (@columns - @attachments.keys).map { |c|
820
- type = eval("#{singular_class}.columns_hash['#{c}']").type
821
- random_data = case type
822
- when :integer
823
- rand(1...1000)
824
- when :string
825
- FFaker::AnimalUS.common_name
826
- when :text
827
- FFaker::AnimalUS.common_name
828
- when :datetime
829
- Time.now + rand(1..5).days
830
- end
831
- c.to_s + ": '" + random_data.to_s + "'"
793
+ @columns_map.map { |col, col_object|
794
+ unless col_object.is_a?(AssociationField)
795
+ random_data = col_object.spec_random_data
796
+ col.to_s + ": '" + random_data.to_s + "'"
797
+ end
832
798
  }.join(", ")
833
799
  end
834
800
 
835
-
836
801
  def regenerate_me_code
837
802
  "rails generate hot_glue:scaffold #{ @meta_args[0][0] } #{@meta_args[1].collect{|x| x.gsub(/\s*=\s*([\S\s]+)/, '=\'\1\'')}.join(" ")}"
838
803
  end
@@ -849,7 +814,6 @@ module HotGlue
849
814
  end
850
815
 
851
816
  def objest_nest_factory_setup
852
- # TODO: figure out what this is for
853
817
  res = ""
854
818
  if @auth
855
819
  last_parent = ", #{@auth_identifier}: #{@auth}"
@@ -872,18 +836,6 @@ module HotGlue
872
836
  @controller_build_name
873
837
  end
874
838
 
875
- def singular_name
876
- @singular
877
- end
878
-
879
- def testing_name
880
- singular_class_name.gsub("::","_").underscore
881
- end
882
-
883
- def singular_class_name
884
- @singular_class
885
- end
886
-
887
839
  def plural_name
888
840
  plural
889
841
  end
@@ -892,78 +844,18 @@ module HotGlue
892
844
  @auth_identifier
893
845
  end
894
846
 
895
- def test_capybara_block(which_partial = :create)
896
- ((@columns - @attachments.keys) - (which_partial == :create ? @show_only : (@update_show_only+@show_only))).map { |col|
897
- type = eval("#{singular_class}.columns_hash['#{col}']").type
898
- case type
899
- when :date
900
- " " + "new_#{col} = Date.current + (rand(100).days) \n" +
901
- ' ' + "find(\"[name='#{testing_name}[#{ col.to_s }]']\").fill_in(with: new_#{col.to_s})"
902
- when :time
903
- # " " + "new_#{col} = DateTime.current + (rand(100).days) \n" +
904
- # ' ' + "find(\"[name='#{singular}[#{ col.to_s }]']\").fill_in(with: new_#{col.to_s})"
905
-
906
- when :datetime
907
- " " + "new_#{col} = DateTime.current + (rand(100).days) \n" +
908
- ' ' + "find(\"[name='#{testing_name}[#{ col.to_s }]']\").fill_in(with: new_#{col.to_s})"
909
-
910
- when :integer
911
- if col.to_s.ends_with?("_id")
912
- capybara_block_for_association(col_name: col, which_partial: which_partial)
913
- else
914
- " new_#{col} = rand(10) \n" +
915
- " find(\"[name='#{testing_name}[#{ col.to_s }]']\").fill_in(with: new_#{col.to_s})"
916
- end
917
- when :float
918
- " " + "new_#{col} = rand(10) \n" +
919
- " find(\"[name='#{testing_name}[#{ col.to_s }]']\").fill_in(with: new_#{col.to_s})"
920
- when :uuid
921
- capybara_block_for_association(col_name: col, which_partial: which_partial)
922
-
923
- when :enum
924
- " list_of_#{col.to_s} = #{singular_class}.defined_enums['#{col.to_s}'].keys \n" +
925
- " " + "new_#{col.to_s} = list_of_#{col.to_s}[rand(list_of_#{col.to_s}.length)].to_s \n" +
926
- ' find("select[name=\'' + singular + '[' + col.to_s + ']\'] option[value=\'#{new_' + col.to_s + '}\']").select_option'
927
-
928
- when :boolean
929
- " new_#{col} = 1 \n" +
930
- " find(\"[name='#{testing_name}[#{col}]'][value='\#{new_" + col.to_s + "}']\").choose"
931
- when :string
932
- faker_string =
933
- if col.to_s.include?('email')
934
- "FFaker::Internet.email"
935
- elsif col.to_s.include?('domain')
936
- "FFaker::Internet.domain_name"
937
- elsif col.to_s.include?('ip_address') || col.to_s.ends_with?('_ip')
938
- "FFaker::Internet.ip_v4_address"
939
- else
940
- "FFaker::Movie.title"
941
- end
942
- " " + "new_#{col} = #{faker_string} \n" +
943
- " find(\"[name='#{testing_name}[#{ col.to_s }]']\").fill_in(with: new_#{col.to_s})"
944
- when :text
945
- " " + "new_#{col} = FFaker::Lorem.paragraphs(1).join("") \n" +
946
- " find(\"[name='#{testing_name}[#{ col.to_s }]']\").fill_in(with: new_#{col.to_s})"
947
- end
847
+ def capybara_make_updates(which_partial = :create)
848
+ @columns_map.map { | col, col_obj|
849
+ show_only_list = which_partial == :create ? @show_only : (@update_show_only+@show_only)
948
850
 
851
+ if show_only_list.include?(col)
852
+ " page.should have_no_selector(:css, \"[name='#{testing_name}[#{ col.to_s }]'\")"
853
+ else
854
+ col_obj.spec_setup_and_change_act(which_partial)
855
+ end
949
856
  }.join("\n")
950
857
  end
951
858
 
952
-
953
- def capybara_block_for_association(col_name: nil , which_partial: nil )
954
- assoc = col_name.to_s.gsub('_id','')
955
- if which_partial == :update && @update_show_only.include?(col_name)
956
- # do not update tests
957
- elsif @alt_lookups.keys.include?(col_name.to_s)
958
- lookup = @alt_lookups[col_name.to_s][:lookup_as]
959
- " find(\"[name='#{singular}[__lookup_#{lookup}]']\").fill_in( with: #{assoc}1.#{lookup} )"
960
- else
961
- " #{col_name}_selector = find(\"[name='#{singular}[#{col_name}]']\").click \n" +
962
- " #{col_name}_selector.first('option', text: #{assoc}1.name).select_option"
963
- end
964
- end
965
-
966
-
967
859
  def path_helper_args
968
860
  if @nested_set.any? && @nested
969
861
  [(@nested_set).collect{|a| "#{a[:singular]}"} , singular].join(",")
@@ -1091,11 +983,9 @@ module HotGlue
1091
983
  else
1092
984
  "@" + @nested_set.last[:singular] + ".#{plural}"
1093
985
  end
1094
-
1095
986
  end
1096
987
  end
1097
988
 
1098
-
1099
989
  def all_objects_root
1100
990
  if @auth
1101
991
  if @self_auth
@@ -1126,7 +1016,6 @@ module HotGlue
1126
1016
  !Gem::Specification.sort_by{ |g| [g.name.downcase, g.version] }.group_by{ |g| g.name }['devise']
1127
1017
  end
1128
1018
 
1129
-
1130
1019
  def magic_button_output
1131
1020
  @template_builder.magic_button_output(
1132
1021
  path: HotGlue.optionalized_ternary(namespace: @namespace,
@@ -1144,7 +1033,6 @@ module HotGlue
1144
1033
  "#{namespace_with_trailing_dash}nav"
1145
1034
  end
1146
1035
 
1147
-
1148
1036
  def include_nav_template
1149
1037
  File.exist?("#{Rails.root}/app/views/#{namespace_with_trailing_dash}_nav.html.#{@markup}")
1150
1038
  end
@@ -1157,7 +1045,7 @@ module HotGlue
1157
1045
  dest_filename = cc_filename_with_extensions("#{view}", "#{@markup}")
1158
1046
 
1159
1047
 
1160
- dest_filepath = File.join("#{'spec/dummy/' if Rails.env.test?}app/views#{namespace_with_dash}",
1048
+ dest_filepath = File.join("#{filepath_prefix}app/views#{namespace_with_dash}",
1161
1049
  @controller_build_folder, dest_filename)
1162
1050
 
1163
1051
 
@@ -1171,7 +1059,7 @@ module HotGlue
1171
1059
  formats.each do |format|
1172
1060
  source_filename = cc_filename_with_extensions( "#{@markup}/#{view}.turbo_stream.#{@markup}")
1173
1061
  dest_filename = cc_filename_with_extensions("#{view}", "turbo_stream.#{@markup}")
1174
- dest_filepath = File.join("#{'spec/dummy/' if Rails.env.test?}app/views#{namespace_with_dash}",
1062
+ dest_filepath = File.join("#{filepath_prefix}app/views#{namespace_with_dash}",
1175
1063
  @controller_build_folder, dest_filename)
1176
1064
 
1177
1065
 
@@ -1180,15 +1068,6 @@ module HotGlue
1180
1068
 
1181
1069
  end
1182
1070
  end
1183
-
1184
- # menu_file = "app/views#{namespace_with_dash}/menu.erb"
1185
- #
1186
- # if File.exist?(menu_file)
1187
- # # TODO: can I insert the new menu item into the menu programatically here?
1188
- # # not sure how i would achieve this without nokogiri
1189
- #
1190
- # end
1191
-
1192
1071
  end
1193
1072
 
1194
1073
  def append_model_callbacks
@@ -1196,7 +1075,7 @@ module HotGlue
1196
1075
 
1197
1076
  if options['with_turbo_streams'] == true
1198
1077
  dest_filename = cc_filename_with_extensions("#{singular_class.underscore}", "rb")
1199
- dest_filepath = File.join("#{'spec/dummy/' if Rails.env.test?}app/models", dest_filename)
1078
+ dest_filepath = File.join("#{filepath_prefix}app/models", dest_filename)
1200
1079
 
1201
1080
 
1202
1081
  puts "appending turbo callbacks to #{dest_filepath}"
@@ -1223,11 +1102,7 @@ module HotGlue
1223
1102
  end
1224
1103
 
1225
1104
  def namespace_with_trailing_dash
1226
- if @namespace
1227
- "#{@namespace}/"
1228
- else
1229
- ""
1230
- end
1105
+ @namespace ? "#{@namespace}/" : ""
1231
1106
  end
1232
1107
 
1233
1108
  def all_views
@@ -1273,7 +1148,6 @@ module HotGlue
1273
1148
  false
1274
1149
  end
1275
1150
 
1276
-
1277
1151
  def model_search_fields # an array of fields we can search on
1278
1152
  []
1279
1153
  end
@@ -1297,11 +1171,6 @@ module HotGlue
1297
1171
  perc_width: @layout_strategy.each_col, #undefined method `each_col'
1298
1172
  layout_strategy: @layout_strategy,
1299
1173
  layout_object: @layout_object
1300
- # columns: @layout_object[:columns][:container],
1301
- # show_only: @show_only,
1302
- # singular_class: singular_class,
1303
- # singular: singular,
1304
- # attachments: @attachments
1305
1174
  )
1306
1175
  end
1307
1176
 
@@ -1313,8 +1182,6 @@ module HotGlue
1313
1182
  end
1314
1183
  end
1315
1184
 
1316
-
1317
-
1318
1185
  def display_class
1319
1186
  me = eval(singular_class)
1320
1187
 
@@ -1368,7 +1235,7 @@ module HotGlue
1368
1235
  flash[:notice] = (flash[:notice] || \"\") << (res ? res + \" \" : \"\")
1369
1236
  rescue ActiveRecord::RecordInvalid => e
1370
1237
  @#{singular}.errors.add(:base, e.message)
1371
- flash[:alert] = (flash[:alert] || \"\") << 'There was ane error #{magic_button}ing your #{@singular}: '
1238
+ flash[:alert] = (flash[:alert] || \"\") << 'There was an error #{magic_button}ing your #{@singular}: '
1372
1239
  end
1373
1240
  end"
1374
1241
 
@@ -1440,7 +1307,7 @@ module HotGlue
1440
1307
  end
1441
1308
 
1442
1309
  def controller_attachment_orig_filename_pickup_syntax
1443
- @attachments.collect{ |key, attachment| "\n" + " modified_params[:#{ attachment[:field_for_original_filename] }] = #{singular_name}_params['#{ key }'].original_filename" if attachment[:field_for_original_filename] }.compact.join("\n")
1310
+ @attachments.collect{ |key, attachment| "\n" + " modified_params[:#{ attachment[:field_for_original_filename] }] = #{singular}_params['#{ key }'].original_filename" if attachment[:field_for_original_filename] }.compact.join("\n")
1444
1311
  end
1445
1312
 
1446
1313
  def any_datetime_fields?