Sha256: c0365f42e3a8672f1c3d3da4a85a4fd836075e9a30d9d754139eeae047058f0f

Contents?: true

Size: 921 Bytes

Versions: 13

Compression:

Stored size: 921 Bytes

Contents

class EmailModelMigration < Migration
  def self.up(site)
    site.records.create_model :emails do |emails|
      add_field :name, :string
      add_field :from, :string
      add_field :to, :string
      add_field :cc, :string
      add_field :bcc, :string
      add_field :subject, :string
      add_field :text_body, :text
      add_field :html_body, :html
      add_field :html_layout, :string
      emails.record_class_name = 'Email'
    end
    
    # template password reset email
    password_reset_email = site.emails.new
    password_reset_email.name = 'password_reset'
    password_reset_email.from = 'admin@site.com'
    password_reset_email.subject = 'Password Reset'
    password_reset_email.text_body = 'Hi <%= options["first_name"] %>, your password has been reset and is now: <%= options["new_password"] %>.'
    password_reset_email.save
  end
  
  def self.down(site)
    site.emails.destroy
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
yodel-0.0.7 lib/yodel/models/migrations/11_email_model.rb
yodel_production_environment-0.0.7 lib/migrations/yodel/11_email_model.rb
yodel_development_environment-0.0.7 lib/migrations/yodel/11_email_model.rb
yodel_production_environment-0.0.4 lib/migrations/yodel/11_email_model.rb
yodel_development_environment-0.0.4 lib/migrations/yodel/11_email_model.rb
yodel-0.0.4 lib/yodel/models/migrations/11_email_model.rb
yodel-0.0.3 lib/yodel/models/migrations/11_email_model.rb
yodel_production_environment-0.0.2 lib/migrations/yodel/11_email_model.rb
yodel_development_environment-0.0.2 lib/migrations/yodel/11_email_model.rb
yodel-0.0.2 lib/yodel/models/migrations/11_email_model.rb
yodel-0.0.1 lib/yodel/models/migrations/11_email_model.rb
yodel_development_environment-0.0.1 lib/migrations/yodel/11_email_model.rb
yodel_production_environment-0.0.1 lib/migrations/yodel/11_email_model.rb