Skip to content

Instantly share code, notes, and snippets.

View curtis's full-sized avatar

Curtis Miller curtis

View GitHub Profile
@curtis
curtis / Generated Routes Example
Created July 21, 2009 01:17
Just an example of Rails routes generated from a resource
time_entries GET /time_entries(.:format) {:action=>"index", :controller=>"time_entries"}
POST /time_entries(.:format) {:action=>"create", :controller=>"time_entries"}
new_time_entry GET /time_entries/new(.:format) {:action=>"new", :controller=>"time_entries"}
edit_time_entry GET /time_entries/:id/edit(.:format) {:action=>"edit", :controller=>"time_entries"}
time_entry GET /time_entries/:id(.:format) {:action=>"show", :controller=>"time_entries"}
PUT /time_entries/:id(.:format) {:action=>"update", :controller=>"time_entries"}
DELETE /time_entries/:id(.:format) {:action=>"destroy", :controller=>"time_entries"}
@curtis
curtis / Generated Routes Example Using :as
Created July 21, 2009 01:27
Just an example of Rails routes after using the :as modifier
time_entries GET /time(.:format) {:action=>"index", :controller=>"time_entries"}
POST /time(.:format) {:action=>"create", :controller=>"time_entries"}
new_time_entry GET /time/new(.:format) {:action=>"new", :controller=>"time_entries"}
edit_time_entry GET /time/:id/edit(.:format) {:action=>"edit", :controller=>"time_entries"}
time_entry GET /time/:id(.:format) {:action=>"show", :controller=>"time_entries"}
PUT /time/:id(.:format) {:action=>"update", :controller=>"time_entries"}
DELETE /time/:id(.:format) {:action=>"destroy", :controller=>"time_entries"}
@curtis
curtis / Named Scope Example
Created July 21, 2009 16:41
An example of named scopes
named_scope :archived, :conditions => ["archived_at IS NOT NULL AND archived_at <= ?", Time.now.utc]
named_scope :not_archived, :conditions => ["archived_at IS NULL OR archived_at > ?", Time.now.utc]
@curtis
curtis / Named Scope Example for Plugins
Created July 21, 2009 16:42
An example of using named scope inside a plugin
named_scope :archived, lambda { { :conditions => ["archived_at IS NOT NULL AND archived_at <= ?", Time.now.utc] } }
named_scope :not_archived, lambda { { :conditions => ["archived_at IS NULL OR archived_at > ?", Time.now.utc] } }
# Rails logs:
/home/myuser/apps/myapp/shared/log/*.log {
daily
missingok
rotate 5
compress
delaycompress
notifempty
copytruncate
create 0666 myuser myuser
ActiveSupport::Inflector.inflections do |inflect|
inflect.singular(/ess$/i, 'ess')
end
>> 'business'.singularize
=> "busines"
rake cucumber # Alias for cucumber:ok
rake cucumber:all # Run all features
rake cucumber:ok # Run features that should pass
rake cucumber:wip # Run features that are being worked on
@ok
Scenario: Successful login
Given there is an account
And I am on the login page
When I fill in "user_session[email]" with a valid email
And I fill in "user_session[password]" with "mittens"
And I press "Log in"
Then I should be on the dashboard page
/!\ FAILSAFE /!\ 09/29/09 03:21
Status: 500 Internal Server Error
invalid byte sequence in US-ASCII