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
#application_controller.rb | |
rescue_from CanCan::AccessDenied do |exception| | |
flash[:error] = "Access Denied" | |
redirect_to root_url | |
end | |
#application_helper.rb | |
def javascript(*files) | |
content_for(:head) { javascript_include_tag(*files)} | |
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
/*Opacity*/ | |
filter: alpha(opacity=80); /* internet explorer */ | |
-khtml-opacity: 0.8; /* khtml, old safari */ | |
-moz-opacity: 0.8; /* mozilla, netscape */ | |
opacity: 0.8; /* fx, safari, opera */ | |
/*Rounded Corners*/ | |
-moz-border-radius: 10px; /* Firefox */ | |
-webkit-border-radius: 10px; /* Safari, Chrome */ | |
border-radius: 10px; /* CSS3 */ |
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
$ rails generate scaffold email_subscriber first_name:string last_name:string email:string | |
$ rake db:migrate |
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
<p id="notice"><%= notice %></p> | |
<p id="show_item"><%= link_to "Email This Page to User", mailit_thepage_path(@thepage) %></p> | |
<p id="show_item"><%= link_to "Download This Page as a PDF", thepage_path(@thepage, :format => "pdf")%></p> | |
<p id="show_item"> | |
<b>Person's Name:</b> | |
<%= Person.find(@thepage.person_id).name %> | |
</p> |
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
class ThepagesController < ApplicationController | |
#Gertig Mailer Method | |
def mailit | |
#Used to send an email to user when they are created | |
#To make this action RESTful you should add the following to your routes.rb file (uncommented of course) | |
#resources :thepages do | |
# member do |
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
class NewMailer < ActionMailer::Base | |
default :from => "[email protected]" | |
require "net/http" | |
def registration_confirmation(person, thepage, email) | |
@person = person #Mailers are similar to Controllers as instance variables are passed to the View layer | |
@thepage = thepage | |
attachments["rails.png"] = File.read("#{Rails.root}/public/images/rails.png") #Used to test attachments, remove in production | |
attachments["#{thepage.id}.pdf"] = {:content => email } |
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
avariable = PDFKit.new(File.read("#{Rails.root}/tmp/somepage.html")) | |
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
Callme::Application.routes.draw do | |
match ':controller(/:action(.:format))' | |
match ':controller(/:action(/:id(.:format)))' | |
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
<h1>Twilio API demo</h1> | |
<h2 style="color: #ff0000"><%= params['msg'] %></h2> | |
<h3>Enter your phone number</h3> | |
<form action="/callme/makecall" method="post"> | |
<input type="text" name="number" /> | |
<input type="submit" value="Call me!"> | |
</form> |
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
xml.instruct! | |
xml.Response do | |
xml.Gather(:action => @postto, :numDigits => 1) do | |
xml.Say "Hello. The Twilio API is pretty awesome." | |
xml.Say "Please press 1 to repeat this menu. Press 2 for directions. Or press 3 if you are done." | |
end | |
end |