Skip to content

Instantly share code, notes, and snippets.

View rduarte's full-sized avatar
🏠
Working from home

Ricardo Duarte rduarte

🏠
Working from home
View GitHub Profile
set :application, "myapp"
set :keep_releases, 5
# git options
set :scm, "git"
set :repository, "git://github.com/georgeguimaraes/myapp.git"
set :branch, "master"
set :deploy_via, :remote_cache
# deploy credentials
@rduarte
rduarte / gist:190009
Created September 21, 2009 01:15 — forked from anonymous/gist:44400
class ApplicationController < ActionController::Base
before_filter :set_application
private
def set_current_account
@current_account = Account.find_by_subdomain(request.subdomains.first)
end
end
class CustomersController < ApplicationController
@rduarte
rduarte / gist:232534
Created November 12, 2009 02:19 — forked from justintv/.bashrc
PS1="\\w:\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)\$ "
@rduarte
rduarte / template.rb
Created November 12, 2009 23:22 — forked from elomar/template.rb
run 'gem sources -a http://gemcutter.org'
git :init
file '.gitignore', <<TXT
log/*.log
tmp/**/*
db/*.sqlite3
.DT_Store
TXT
Rails CMS alternatives
======================
Active projects:
---------------
adva-cms
repo: http://github.com/svenfuchs/adva_cms/
site: http://adva-cms.org/
Last update: 11/24/09
"the cutting edge Rails CMS platform"
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
$(function () {
var toc = $("<ul>").css("margin-bottom", "20px !important");
$("div.main div.wikistyle h2").each(function() {
var id = $(this).text().replace(/\s+/g, "_").replace(/[^0-9a-zA-Z_.-]/g, "")
$(this).attr("id", id)
toc.append(
$("<li>").append($("<b>").append($("<a>").attr("href", "#" + id).text($(this).text())))
)
});
$("div.wikistyle").prepend(toc).prepend($("<h2>").text("Table of Contents"));
# How to give your devise controllers all the same layout (e.g. "authentication" below)
class ApplicationController < ActionController::Base
layout :setup_layout
protected
def setup_layout
devise_controller? ? "authentication" : "application"
end
end
@rduarte
rduarte / Gemfile
Created January 17, 2011 18:23 — forked from carlosbrando/Gemfile
group :development, :test do
gem 'ruby-debug', :platforms => :ruby_18
gem 'ruby-debug19', :platforms => :ruby_19
end

gurizei.

quando tu faz no rails "render :xml => @any_collection", ele chama o to_xml passando uma série de parâmetros no options, logo, se tu implementa teu to_xml assim:

    def to_xml(options = {})
        super(:include => [:children])
    end

tu não vai estar repassando pro super o "options" - que nesse caso vem com algo do tipo: