wswsw

Ruby code posted by swsw
created at 06 Feb 12:01

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# encoding: utf-8
class UserMailer < ActionMailer::Base
  
  default :from => "noreply@styleup.ru"
  default_url_options[:host] = "styleup.ru"

  def self.delay(que = nil)
    MyUserMailer.new()
  end


  def welcome_email(user_id)
    @user = User.find(user_id)
    mail(:to      => @user.email,
         :subject => "Добро пожаловать в StyleUP: Здесь Вы можете быстро найти и забронировать лучший салон в вашем городе.")
  end

  def booked_appointment_user(appointment_id)
    @appointment = Appointment.find(appointment_id)
    @service_provider = @appointment.service_provider
    @user = @appointment.user
    date_str = I18n.l @appointment.start_date, :format => '%e-%b-%y'
    mail(:to      => @user.email,
         :subject => "#{@appointment.service_provider_service_name} забронирован на #{date_str}")
  end

  def booked_appointment_service_provider(appointment_id)
    @appointment = Appointment.find(appointment_id)
    @service_provider = @appointment.service_provider
    date_str = I18n.l @appointment.start_date, :format => '%e-%b-%y'
    mail(:to      => @service_provider.user.email,
         :subject => "#{@appointment.service_provider_service_name} забронирован на #{date_str}")
  end

  def welcome_service_provider_email(service_provider_id)
    @service_provider = ServiceProvider.find(service_provider_id)
    mail(:to      => @service_provider.user.email,
         :subject => "Добро пожаловать в StyleUP: Профиль успешно создан")
  end

  def reset_password_email(user_id, password)
    @user = User.find(user_id)
    @password = password
    mail(:to      => @user.email,
         :subject => "StyleUP: пароль успешно восстановлен")
  end
end
1.68 KB in 3 ms with coderay