Перевод "Rails in a nutshell Chapter 5. Action Mailer"

Cody Fauser, James MacAulay, Edward Ocampo-Gooding, John Guenin, “Rails in a nutshell Chapter 5. Action Mailer”, public translation into Russian from English More about this translation.

See also 29 similar translations

Translate into another language.

Participants

and_rew202 points
blandger142 points
Join Translated.by to translate! If you already have a Translated.by account, please sign in.
If you do not want to register an account, you can sign in with OpenID.
Pages: ← previous Ctrl next next untranslated
1 2 3 4 5 6 7 8

Rails in a nutshell Chapter 5. Action Mailer

Chapter 5. Action Mailer

Глава 5. Action Mailer

History of edits (Latest: and_rew 1 year, 7 months ago) §

Action Mailer is a framework for sending and receiving email. It makes sending templated email, gracefully degrading HTML email, email with attachments, and receiving email simple, while abstracting away complex issues like MIME encoding and quoting. This chapter will cover all the most important aspects of Action Mailer including the generation of mailers, sending email, and the configuration and testing of mailers.

Action Malier - это каркас для отправки и получения почты. Он позволяет отправлять шаблонные почтовые сообщения, существенно облегчает работу с HTML-сообщениями и почтовыми вложениями, упрощает получение почты, абстрагируясь от таких сложных понятий, как MIME-кодирование и цитирование. В этой главе рассматриваются наиболее важные аспекты из Action Mailer, включая генерацию отправителей, отправку почты, а также настройку и тестирование отправителей.

History of edits (Latest: and_rew 1 year, 7 months ago) §

— mailer - отправитель, рассылка? and_rew

Generating Mailers

Создание отправителей

History of edits (Latest: and_rew 1 year, 7 months ago) §

Rails provides a generator for creating new mailer models. The generator is passed the mailer name in underscored or camel case format followed by zero or more actions:

Rails предоставляет генератор для создания новой модели отправителя. Генератор получает имя отправителя с нижними подчеркиваниями или CamelCase-формате, после которого могут быть перечислены действия:

History of edits (Latest: and_rew 1 year, 7 months ago) §

script/generate mailer mailer_name [action...]

script/generate mailer mailer_name [action...]

History of edits (Latest: and_rew 1 year, 7 months ago) §

The generator creates the following files:

Генератор создаст следующие файлы:

History of edits (Latest: and_rew 1 year, 7 months ago) §

*

*

History of edits (Latest: and_rew 1 year, 7 months ago) §

mailer class in app/models.

класс отправителя в app/models.

History of edits (Latest: and_rew 1 year, 7 months ago) §

*

*

History of edits (Latest: and_rew 1 year, 7 months ago) §

view templates for each action in app/views/mailer_name.

шаблоны видов для каждого действия в app/views/mailer_name.

History of edits (Latest: and_rew 1 year, 7 months ago) §

*

*

History of edits (Latest: and_rew 1 year, 7 months ago) §

unit test stub in test/unit.

заглушки модульных тестов в test/unit.

History of edits (Latest: and_rew 1 year, 7 months ago) §

*

*

History of edits (Latest: and_rew 1 year, 7 months ago) §

test fixtures for each action in test/fixtures/mailer_name.

тестовые заготовки для каждого действия в test/fixtures/mail_name.

History of edits (Latest: and_rew 1 year, 7 months ago) §

The following command generates a new mailer model class named OrderMailer with a single action confirmation:

Следующая команда сгенерирует новый класс модели отправителя с именем OrderMailer с единственным действием confirmation:

History of edits (Latest: and_rew 1 year, 7 months ago) §

$ script/generate mailer OrderMailer confirmation

$ script/generate mailer OrderMailer confirmation

History of edits (Latest: and_rew 1 year, 7 months ago) §

create app/models/

создает app/models/

History of edits (Latest: and_rew 1 year, 7 months ago) §

create app/views/order_mailer

создает app/views/order_mailer

History of edits (Latest: and_rew 1 year, 7 months ago) §

create test/unit/

создает test/unit/

History of edits (Latest: and_rew 1 year, 7 months ago) §

create test/fixtures/order_mailer

создает test/fixtures/order_mailer

History of edits (Latest: and_rew 1 year, 7 months ago) §

create app/models/order_mailer.rb

создает app/models/order_mailer.rb

History of edits (Latest: and_rew 1 year, 7 months ago) §

create test/unit/order_mailer_test.rb

создает test/unit/order_mailer_test.rb

History of edits (Latest: and_rew 1 year, 7 months ago) §

create app/views/order_mailer/confirmation.erb

создает app/views/order_mailer/confirmation.erb

History of edits (Latest: and_rew 1 year, 7 months ago) §

create test/fixtures/order_mailer/confirmation

создает test/fixtures/order_mailer/confirmation

History of edits (Latest: and_rew 1 year, 7 months ago) §

Sending Email

Отправка почты

History of edits (Latest: and_rew 1 year, 7 months ago) §

A mailer model's job is to encapsulate the creation and delivery of the different email messages that you need for a particular component of your application. For example, an OrderMailer would define all of the email messages for communicating with a customer regarding an order they've placed at your online store.

Задача модели отправителя заключается в инкапсулировании создания и доставки различных почтовых сообщений, обычно используемых в приложениях. Например, OrderMailer определяет все виды почтовых сообщений для связи с клиентами через заказы, которые они оставляют в нашем online-хранилище.

History of edits (Latest: and_rew 1 year, 7 months ago) §

There are two parts to a mailer: the model and the view. The model portion is stored along with the rest of your models in app/models. The mailer's views are stored in a subdirectory, named after the mailer model, underneath app/views with the rest of your application's views. Therefore an OrderMailer model would itself be stored as app/models/order_mailer.rb and would look for its view templates under the directory app/views/order_mailer.

Есть две части отправителя: модель (model) и представление (view). Модель хранится вместе с вашими остальными моделями в каталоге app/models. Представления отправителя сохраняются в подкаталоге, именованном по названию модели отправителя, в подапке app/views вместе с остальными представлениями приложения. Следовательно, модель с названием OrderMailer, должна сохранится как app/models/order_mailer.rb и искать шаблоны представлений в каталоге app/views/order_mailer/.

History of edits (Latest: blandger 1 year, 6 months ago) §
Pages: ← previous Ctrl next next untranslated
1 2 3 4 5 6 7 8