bborn / lewsnetter

E-mail marketing application (create and send e-mail newsletter via SES). Includes subscription management, delivery, bounce and complaint notification, templates, and some stats.
MIT License
318 stars 42 forks source link

Fresh start fails #1

Closed ddeyoung closed 9 years ago

ddeyoung commented 9 years ago

https://github.com/bborn/lewsnetter/blob/master/config/initializers/devise.rb#L13

The Devise initializer pulling from Setting fails because the smailer relation does not yet exist when running rake db:setup or any command used to initialize the database.

PG::UndefinedTable: ERROR: relation "smailer_properties" does not exist LINE 5: WHERE a.attrelid = '"smailer_properties"'::re... ^ : SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"smailer_properties"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum

/opt/rubies/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `async_exec': PG::UndefinedTable: ERROR: relation "smailer_properties" does not exist LINE 5: WHERE a.attrelid = '"smailer_properties"'::re... ^ : SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"smailer_properties"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum (ActiveRecord::StatementInvalid)

bborn commented 9 years ago

Hmm, looks like we could set that config variable as a proc to avoid this. Can you try this?

config.mailer_sender = Proc.new { Setting.get_with_default('mail.from', Rails.application.config.settings.mail.from) } 
bborn commented 9 years ago

Fixed in 590b192dfaf870760ea9569a2fa284cfbd59cf7a

ddeyoung commented 9 years ago

Confirmed that this solved the issue.