Я установил Devise для моего приложения Rails (3.0.1), и он работает в основном. Я просто , похоже, не может настроить настройки почтового ящика.Ruby/Rails: Как вы настраиваете шаблоны почтовой рассылки Devise?
- Моя модель пользователя «Пользователь».
- Контроллеры DEViSE (которые мне нужно было отменить, так что я мог бы сказать, что контроллеры файл макета для использования) в
app/controllers/users/
, как иapp/controllers/users/sessions_controller.rb
- разработать взгляды (которые я отредактирован) в
app/views/users/
как такapp/views/users/registrations/new.html.haml
- Вот Разрабатывают часть моего файла маршрутов:
devise_for :users, :controllers => { :sessions => "users/sessions", :registrations => "users/registrations", :passwords => "users/passwords", :confirmations => "users/confirmations", :unlocks => "users/unlocks" } do get "/login" => "devise/sessions#new" get "/logout" => "devise/sessions#destroy" end
Все выше работ, по крайней мере. Однако при отправке почты шаблоны, которые, как представляется, используют Devise, не те, что я редактировал на app/views/users/mailer/
. Похоже, что Devise по-прежнему подходит по умолчанию (как будто я никогда не редактировал файлы). Я предполагаю, что Devise по-прежнему использует файлы в драгоценном камне.
В случае помогает, вот ошибка Огурцы:
Feature: Manage accounts
In order to manage accounts
users
should be able to signup
# By default, www.example.com is the host when testing.
# This is a problem because when our site searches for the domain example.com, it cant find any.
# Therefore we must either set our testing domain to one of our choosing (and mention that in the routes), or create a domain example.com
# I prefer the first option.
Scenario: Signing up and resetting the password # features/manage_accounts.feature:10
Given I am on the login page # features/step_definitions/web_steps.rb:19
When I follow "Sign up" # features/step_definitions/web_steps.rb:33
And I fill in "Login" with "bobrobcom" # features/step_definitions/web_steps.rb:39
And I fill in "Email" with "[email protected]" # features/step_definitions/web_steps.rb:39
And I fill in "Password" with "123456" # features/step_definitions/web_steps.rb:39
And I fill in "Password confirmation" with "123456" # features/step_definitions/web_steps.rb:39
And I press "Sign up" # features/step_definitions/web_steps.rb:27
Then I should see "Your account has been created. A confirmation was sent to your e-mail." # features/step_definitions/web_steps.rb:107
And I should receive an email # features/step_definitions/email_steps.rb:51
When I open the email # features/step_definitions/email_steps.rb:72
Then I should see "Welcome bobrobcom!" in the email body # features/step_definitions/email_steps.rb:96
expected "<p>Welcome [email protected]!</p>\n\n<p>You can confirm your account through the link below:</p>\n\n<p><a href=\"http://stils.dev/users/confirmation?confirmation_token=d9ZXliqfTArb2cNmwPzL\">Confirm my account</a></p>\n" to include "Welcome bobrobcom!" (RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/email_steps.rb:97:in `/^(?:I|they) should see "([^"]*?)" in the email body$/'
features/manage_accounts.feature:21:in `Then I should see "Welcome bobrobcom!" in the email body'
When I follow "Confirm my account" # features/step_definitions/web_steps.rb:33
Then I should see "Your account was successfully confirmed. You are now signed in." # features/step_definitions/web_steps.rb:107
When I log out # features/step_definitions/user_steps.rb:9
And I go to the reset password page # features/step_definitions/web_steps.rb:23
And I fill in "Email" with "[email protected]" # features/step_definitions/web_steps.rb:39
And I press "Send me reset password instructions" # features/step_definitions/web_steps.rb:27
Then I should see "You will receive an email with instructions about how to reset your password in a few minutes." # features/step_definitions/web_steps.rb:107
And I should receive an email # features/step_definitions/email_steps.rb:51
When I open the email # features/step_definitions/email_steps.rb:72
Then I should see "Hello bobrobcom!" in the email body # features/step_definitions/email_steps.rb:96
When I follow "Change my password" in the email # features/step_definitions/email_steps.rb:166
Then I should see "Set your new password" # features/step_definitions/web_steps.rb:107
Failing Scenarios:
cucumber features/manage_accounts.feature:10 # Scenario: Signing up and resetting the password
и приложение/просмотров/пользователей/confirmation_instructions.erb:
<p>Welcome <%= @resource.login %>!</p>
<p>You can confirm your account through the link below:</p>
<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
Кроме того, если это помогает, вот контроллеры I 'over overed:
| | |~users/
| | | |-confirmations_controller.rb
| | | |-passwords_controller.rb
| | | |-registrations_controller.rb
| | | |-sessions_controller.rb
| | | `-unlocks_controller.rb
Как исправить эту проблему?
Спасибо!
Я запутался - так как все мои вещи находятся под пространством имен пользователей, должны ли представления быть под «app/views/users /»? Это то, что у меня есть сейчас, и когда я редактирую представления для другого материала (например, приложения/представления/пользователи/регистрации), он отражает изменение в моем приложении. * Не * просмотр приложений/просмотров/пользователей/мейкеров. – 2010-12-03 02:48:14
Кажется, у вас есть шаблоны почтовой рассылки в нужном месте. Посмотрите на эту тему http://groups.google.com/group/plataformatec-devise/browse_thread/thread/98cdb37ac52bdf51, может быть, она может указать вам в правильном направлении? – 2010-12-04 23:11:38