Class: EmailsController

Inherits:
Spree::BaseController
  • Object
show all
Includes:
ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper
Defined in:
app/controllers/emails_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/emails_controller.rb', line 6

def show
  @subscriber = Subscriber.find_by_token(params[:subscriber])
  @email      = Email.find_by_token(params[:email])
  if @email.recipients.include?(@subscriber.email)  
    @email_subject = @email.render(:subject, @subscriber)
    @text          = @email.render(:body,    @subscriber)
    @base_url      = "http://#{Spree::Config[:site_url]}"
    render :layout => 'email', :text => simple_format(@text)    
  else
    flash[:error] = t('unintened_email_view')
    redirect_to new_subscriber_path
  end
end