Skip to content

Instantly share code, notes, and snippets.

Avatar

Wioletta Holownia viola

  • DigitalOcean
  • NYC
View GitHub Profile
@viola
viola / http_method_not_allowed
Created Sep 26, 2011
Render 405 response for ActionController::UnknownHttpMethod exceptions
View http_method_not_allowed
ActionController::UnknownHttpMethod exception found under rails 3.0.1
$ cat lib/http_method_not_allowed.rb
# Render 405 response for ActionController::UnknownHttpMethod exceptions like:
# (ActionController::UnknownHttpMethod) "CONNECT, accepted HTTP methods are get, head, put, post, delete, and options"
# (ActionController::UnknownHttpMethod) "PROPFIND, accepted HTTP methods are get, head, put, post, delete, and options"
class HttpMethodNotAllowed
def initialize(app)
@app = app
@viola
viola / gist:1070410
Created Jul 7, 2011
Example of fetching Hash (key,value) to the simple_form collection.
View gist:1070410
-- model
some sort of constant hash:
HASH_NAME = {
0 => "Choose:",
1 => "On-Campus Recruiting - CSO",·
2 => "CSO Staff Referral",
3 => "Faculty Contact",·
4 => "Career Day",·
5 => "CSO Summer Job Listing",·
6 => "Alumni Contact",·