Created
September 30, 2012 19:47
-
-
Save dannymcc/3808272 to your computer and use it in GitHub Desktop.
Calls Mailer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GET /calls | |
# GET /calls.json | |
def index | |
@calls = Call.order('time DESC').where(:destination => ["123", "456", "789"]).page(params[:page]).per_page(25) | |
@calls_today = Call.where("created_at >= ?", Time.now.beginning_of_day) | |
respond_to do |format| | |
format.html # index.html.erb | |
format.json { render json: @calls } | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= Call.first.time.strftime("%d %b. %Y - %H:%M") %> | |
<% @calls_today.each do |call| %> | |
<%= call.time %> | |
<% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Call Load (0.3ms) SELECT `calls`.* FROM `calls` LIMIT 1 | |
ActionView::Template::Error: undefined method `each' for nil:NilClass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calls_email(call) | |
@call = call | |
mail to: "[email protected]", subject: "Out of Hour Calls" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment