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
## Copyright 2009 Rex Luther Corporation. | |
## Licensed under the MIT License | |
## http://www.opensource.org/licenses/mit-license.php | |
def valid_phone | |
return true if phone.blank? | |
phone_formats = [ | |
/^\(\d\d\d\) \d\d\d-\d\d\d\d/, | |
/^\d\d\d\.\d\d\d\.\d\d\d\d/, |
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
## Copyright 2009 Rex Luther Corporation. | |
## Licensed under the MIT License | |
## http://www.opensource.org/licenses/mit-license.php | |
it "should require a phone number have a valid format" do | |
@contact.phone = '(919) 555-1212' | |
@contact.should be_valid | |
@contact.phone = '919-555-1212' | |
@contact.should be_valid |
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
#!/usr/bin/env ruby | |
command = '/usr/bin/passenger-memory-stats' | |
memory_limit = 200 # megabytes | |
def running?(pid) | |
begin | |
return Process.getpgid(pid) != -1 | |
rescue Errno::ESRCH | |
return false |
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
<!--#if expr="!${NoAds}" --> | |
<script src="http://www.example.com/foo.js" type="text/javascript"></script> | |
<!--#endif --> |
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
SetEnv NoAds true |
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 post_contact_json | |
contact = { | |
:contact => { | |
:email => '[email protected]', | |
:verify_email => '[email protected]', | |
:first_name => 'joe', | |
:last_name => 'test', | |
:phone => '919-555-1212', | |
:responses_attributes => { |
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
Processing ContactsController#create (for 0.0.0.0 at 2009-03-23 22:17:28) [POST] | |
Parameters: {"action"=>"create", "controller"=>"contacts"} | |
NoMethodError (You have a nil object when you didn't expect it! | |
You might have expected an instance of ActiveRecord::Base. | |
The error occurred while evaluating nil.[]): |
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 create | |
valid_save = true | |
Contact.transaction do | |
## See if we're dealing with a new @contact or an existing contact | |
## FIXME: Error out if email isn't filled in. | |
@contact = Contact.find_by_email( params[:contact][:email] ) | |
if @contact.nil? | |
logger.debug("New contact") |
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
(in /Users/otto/Desktop/Incubator/shallow_routes) | |
communities GET /communities(.:format) {:action=>"index", :controller=>"communities"} | |
POST /communities(.:format) {:action=>"create", :controller=>"communities"} | |
new_community GET /communities/new(.:format) {:action=>"new", :controller=>"communities"} | |
edit_community GET /communities/:id/edit(.:format) {:action=>"edit", :controller=>"communities"} | |
community GET /communities/:id(.:format) {:action=>"show", :controller=>"communities"} | |
PUT /communities/:id(.:format) {:action=>"update", :controller=>"communities"} | |
DELETE /communities/:id(.:format) {:action=>"destroy", :controller=>"communities"} | |
community_forums GET /communities/:community_id/forums(.:format) {:action=>"index", :controller=>"forums"} | |
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
it "should map #edit" do | |
route_for(:controller => "admin/responses", :action => "edit", :id => "1", :message_id => "1").should == "/contact/admin/messages/1/responses/1/edit" | |
end | |
it "should map #update" do | |
route_for(:controller => "admin/responses", :action => "update", :id => "1", :message_id => "1").should == { :path => "/contact/admin/messages/1/responses/1", :method => :put } | |
end | |
it "should map #destroy" do | |
route_for(:controller => "admin/responses", :action => "destroy", :id => "1", :message_id => "1").should == { :path => "/contact/admin/messages/1/responses/1", :method => :delete } |
OlderNewer