Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Rails 3.1 action mailer useage
- <tr id=<%= dom_id(blast)%> class="blast">
- <td><%= blast.id %></td>
- <td><%= blast.description %></td>
- <td><%= blast.subject %></td>
- <td><%= blast.last_sent %></td>
- <td><%= blast.created_at.strftime('%D at %I:%M %p') %></td>
- <td><%= link_to "Destroy", blast,:remote => true, :confirm => "Are You Sure?", :method => :delete %></td>
- <td><%= link_to "Edit",edit_blast_path(blast), :remote => true, :action => "edit"%></td>
- <td><%= link_to "Mail",blast, :action => 'show', :remote => true%></td>
- class BlastsController < ApplicationController
- before_filter :require_user
- respond_to :html, :js
- def index
- @blasts = Blast.page(params[:page]).per(10)
- end
- def show
- @customer = Customer.all
- @blast = Blast.find(params[:id])
- end
- def create
- @blast = Blast.new(params[:blast])
- if @blast.save
- respond_with @blast, :location => blasts_url
- end
- end
- def destroy
- @blast = Blast.find(params[:id])
- @blast.destroy
- respond_with @blast, :location => blasts_url
- end
- def edit
- @blast = Blast.find(params[:id])
- respond_with @blast, :location => blasts_url
- end
- def update
- @blast = Blast.find(params[:id])
- @blast.update_attributes(params[:blast])
- respond_with @blast, :location => blasts_url
- end
- end
- class BlastMailer < ActionMailer::Base
- default from: "info@ratatouillecatering.com"
- def mail_blast(customer, blast)
- @customer = customer
- @blast=blast
- @customer.each do |f|
- mail(:to => f.email, :subject => "hello")
- end
- end
- end
Add Comment
Please, Sign In to add comment