Send With Confidence
Partner with the email service trusted by developers and marketers for time-savings, scalability, and delivery expertise.
Time to read: 2 minutes
$ rails g model post body:text email:string
gem 'griddler'
Partner with the email service trusted by developers and marketers for time-savings, scalability, and delivery expertise.
class PostsController < ApplicationController | |
def index | |
@posts = Post.all | |
end | |
end |
<h1>Posts</h1> | |
<% if @posts.count > 0 %> | |
<% @posts.each do |post| %> | |
<blockquote> | |
<p><%= post.body %></p> | |
<small><%= post.email %></small> | |
</blockquote> | |
<% end %> | |
<% else %> | |
<p><em>Oops, doesn't look like there are any posts yet.</em></p> | |
<% end %> |
class EmailProcessor | |
def self.process(email) | |
Post.create!({ body: email.body, email: email.from }) | |
end | |
end |