This file contains 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
NoMethodError (super: no superclass method `request_parameters'): | |
gems/gems/actionpack-3.2.13/lib/action_dispatch/http/request.rb:237:in `POST' | |
gems/gems/actionpack-3.2.13/lib/action_dispatch/http/parameters.rb:10:in `parameters' |
This file contains 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 Foo | |
public def my_public_method | |
1 + 2 | |
end | |
protected def my_protected_method | |
3 + 4 | |
end | |
def my_private_method |
This file contains 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
# Orignal | |
module ActionController | |
class Responder | |
def to_format | |
if get? || !has_errors? || response_overridden? | |
default_render | |
else | |
display_errors | |
end |
This file contains 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 self.tree(path = nil) | |
Rails.cache.fetch("folder-tree-#{path}", expires_in: 0) do | |
folders = Folder.where('path LIKE ?', "#{path}%").all | |
path_parts = path.to_s.count('/') | |
local_root = root | |
local_first_tier = [] | |
folders.each do |folder| | |
folder.children = folders.select { |f| f.parent_id == folder.id }.sort { |a, b| a.position <=> b.position } | |
local_root = folder if path == folder.path |
This file contains 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
puts "hello joe" |
This file contains 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
module Rack | |
class Request | |
def subdomains(tld_len=1) # we set tld_len to 1, use 2 for co.uk or similar | |
# cache the result so we only compute it once. | |
@env['rack.env.subdomains'] ||= lambda { | |
# check if the current host is an IP address, if so return an empty array | |
return [] if (host.nil? || | |
/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.match(host)) | |
host.split('.')[0...(1 - tld_len - 2)] # pull everything except the TLD | |
}.call |
NewerOlder