mercredi 4 novembre 2015

uninitialized constant WhatCountsNewsletter::WhatCounts

Hello I am getting an error while sending the email so please have look

NameError in Siteman/newslettersController#send_to_testers

uninitialized constant WhatCountsNewsletter::WhatCounts

RAILS_ROOT: /var/www/sites/preit/releases/siteman Application Trace | Framework Trace | Full Trace

/var/www/sites/preit/releases/siteman/vendor/rails/activesupport/lib/active_support/dependencies.rb:131:in rescue in const_missing' /var/www/sites/preit/releases/siteman/vendor/rails/activesupport/lib/active_support/dependencies.rb:120:inconst_missing' /var/www/sites/preit/releases/siteman/app/models/what_counts_newsletter.rb:22:in configure_whatcounts_client' /var/www/sites/preit/releases/siteman/app/models/what_counts_newsletter.rb:66:indeliver_as_test' /var/www/sites/preit/releases/siteman/app/controllers/siteman/newsletters_controller.rb:101:in send_to_testers' /var/www/sites/preit/releases/siteman/app/controllers/siteman/siteman_controller.rb:31:incall' /var/www/sites/preit/releases/siteman/app/controllers/siteman/siteman_controller.rb:31:in `block in '

newsletters_controller.rb

 def send_to_testers
@newsletter = @current_website.newsletters.find(params[:id])
@newsletter.update_attributes(params[:newsletter])

audit_trail "Newsletter \##{@newsletter.id}: #{@newsletter.list_id} #{@newsletter.name}  was delivered to the Test Recipients."
# Error Checking & Reporting!
results = @newsletter.deliver_as_test(@current_user)
logger.debug "[DBUG] Test Send Results: #{results}"
render :text => "Test E-Mails Delivered, now you can sent email to subscribers OR further tests can be sent instead", :status => 200

end

what_counts_newsletter.rb

 def configure_whatcounts_client
newsletter = self
WhatCounts::HttpClient.configure do
  realm    newsletter.realm
  password newsletter.password
end

end

def deliver_as_test(initiated_by)
configure_whatcounts_client
WhatCounts::OneOffMessage.send!(:list_id     => list_id,
                                :subject     => "[TEST] #{subject_line}",
                                :to          => approval_recipients,
                                :format      => 2)
remove_lock
update_attribute(:last_tested_at, Time.zone.now)

end

Aucun commentaire:

Enregistrer un commentaire