Skip to content

Instantly share code, notes, and snippets.

View bear454's full-sized avatar

James Mason bear454

View GitHub Profile
#!/usr/bin/ruby
require 'rubygems'
require 'sinatra'
require 'haml'
require 'gdata'
PROJECT_PATH = "/your/project/path"
DOMAIN = 'your_google_apps_domain_or_blank_for_any_google_account.com'
@bear454
bear454 / some_random_view.html.erb
Created August 27, 2009 19:17
Bare example of link_to_remote: clicking the "Update" link in the view will change the text in the update_me span to 'Updated text.'
<span id="update_me">Some text that needs to be updated.</span>
<%=link_to_remote "Update", :url => "/update/something", :update => 'update_me' %>
def class Cart < ActiveRecord::Base
#...
def installation_instructions_pdf(pdf = nil)
pdf ||= Prawn::Document.new
eval(IO.read("app/views/cards/installation.pdf.prawn"))
pdf
end
#...
class Person < ActiveRecord::Base
has_many :orders
has_many :lines, :through => :products
has_many :products, :through => :lines
end
class Order < ActiveRecord::Base
has_many :lines
has_many :products, :through => :lines
end