lib/rails3_assist/base/insert.rb in rails3_assist-0.2.2 vs lib/rails3_assist/base/insert.rb in rails3_assist-0.2.3
- old
+ new
@@ -1,11 +1,15 @@
module Rails::Assist
module BaseHelper
# UPDATE
def insert_content(name, options={}, &block)
type = get_type(options)
- file = existing_file_name(name, type)
+ file = existing_file_name(name, type)
+ raise "No file could be determined: #{file} from name: #{name} of type: #{type}" if !file
+ raise "File to insert in not found: #{file} for #{type}" if !File.file?(file)
+
x_marker = marker(name, type, options)
+
res = file_insertion file, x_marker, options, &block
if !res
# try with :embedded option if default doesn't work
x2_marker = marker(name, type, options.merge(:model_type => :embedded))
file_insertion file, x2_marker, options, &block
\ No newline at end of file