diff --git a/Gemfile b/Gemfile index 1aef709..28b7e61 100644 --- a/Gemfile +++ b/Gemfile @@ -45,6 +45,9 @@ gem 'ckeditor' gem 'unicorn' gem 'zhconv' +#form helpers +gem 'dynamic_form' + #built in modules eval(File.read(File.dirname(__FILE__) + '/built_in_extensions.rb')) #modules installed from the store diff --git a/app/mailers/orbit_mailer.rb b/app/mailers/orbit_mailer.rb index de28672..a382bb2 100644 --- a/app/mailers/orbit_mailer.rb +++ b/app/mailers/orbit_mailer.rb @@ -30,8 +30,8 @@ class OrbitMailer < ActionMailer::Base unless email.email_files.blank? email.email_files.each_with_index do |email_file, i| file_type = File.extname(email_file.file.to_s) - file_content = File.read(email_file.file.url) - attachments["#{email_file.title}#{file_type}"] = file_content.read + # file_content = File.read(email_file.file.url) + attachments["#{email_file.title}#{file_type}"] = email_file.file.read end end @@ -61,6 +61,8 @@ class OrbitMailer < ActionMailer::Base }) mail_log.save + + email.destroy end diff --git a/app/models/email.rb b/app/models/email.rb index e834baf..7186ff1 100644 --- a/app/models/email.rb +++ b/app/models/email.rb @@ -20,6 +20,7 @@ class Email field :update_user_id has_many :email_files, :autosave => true, :dependent => :destroy + accepts_nested_attributes_for :email_files, :allow_destroy => true scope :can_deliver, ->{ where(:mail_sentdate.lte => Time.now, :is_sent=>false) } diff --git a/app/views/layouts/_right_menu.html.erb b/app/views/layouts/_right_menu.html.erb index a4d33f7..b9325cc 100644 --- a/app/views/layouts/_right_menu.html.erb +++ b/app/views/layouts/_right_menu.html.erb @@ -56,22 +56,25 @@