My Recent Pastes (53 and counting)
Pastes by Pat Allan (53 and counting)
Below are the 15 most recent pasties by Pat Allan.
September 20, 2007
1:20AM EDT
by Pat Allan
View all 11 lines
class ProjectMilestone < ActiveRecord:Base # ... def self.find(*args)
September 19, 2007
12:18AM EDT
by Pat Allan
View all 6 lines
@topics = Topic.paginate(
:page => params[:page],
:conditions => "forum_id = #{@forum.id} AND deleted_at IS NULL",
:order => "topics.updated_at desc",
:per_page => 15
September 19, 2007
12:18AM EDT
by Pat Allan
View all 40 lines
class Array
def with(user)
return self.each { |item| item.read = true } if user.nil?
ids, sql, conditions = [], "", ""
September 18, 2007
10:03AM EDT
by Pat Allan
View all 33 lines
class Item < ActiveRecord::Base
set_table_name <<-SQL
(SELECT p.id, p.subject, p.content, p.created_by, p.updated_by, p.deleted_by,
p.created_at, p.updated_at, p.deleted_at, NULL as url, NULL as name,
NULL as description, tg.taggable_type as type,
September 18, 2007
9:56AM EDT
by Pat Allan
View all 40 lines
class Item < ActiveRecord::Base
def self.abstract_class?
true
end
September 17, 2007
10:38PM EDT
by Pat Allan
View all 25 lines
def self.import_from_titlepage(ean)
config = Configuration.load
RBook::TitlePage::Client.open(config.titlepage_username, config.titlepage_password) do |tp|
result = tp.find(ean)
unless result.nil?
September 06, 2007
12:56AM EDT
by Pat Allan
View all 15 lines
module ActiveRecord
class Base
class << self
def validates_value_of(*attrs)
options = attrs.last.is_a?(Hash) ? attrs.pop : {}
September 04, 2007
8:49PM EDT
by Pat Allan
View all 26 lines
class Invoice < ActiveRecord::Base
# ...
define_index do |index|
index.includes(:id).as.invoice_id
September 04, 2007
11:05AM EDT
by Pat Allan
View all 34 lines
# to put in RAILS_ROOT/config/ultrasphinx # can be namespaced individually (development.base) indexer
September 04, 2007
10:05AM EDT
by Pat Allan
View all 19 lines
index = ThinkingSphinx::Index.new(Invoice) index.includes.address.state index.includes.customer.postal_address.country index.includes.items.edition.ean index.includes.items.order_item.edition.name
September 04, 2007
9:45AM EDT
by Pat Allan
View all 6 lines
index = ThinkingSphinx::Index.new(Invoice) index.includes.address.state index.includes.customer.postal_address.country index.includes.items.edition.ean index.includes.items.order_item.edition.name
September 03, 2007
11:04PM EDT
by Pat Allan
View all 7 lines
class MyController < ApplicationController
self.template_root = "custom/path/instead/of/app/views"
def self.controller_path
"custom/controller/folder" # ie. app/views/THIS_FOLDER/action
September 03, 2007
11:02PM EDT
by Pat Allan
class MyController < ApplicationController self.template_root = "custom/path/instead/of/app/views" end
