Skip to content

Instantly share code, notes, and snippets.

View landlessness's full-sized avatar

Brian S. Mulloy landlessness

View GitHub Profile
module ActiveRecord
class Base
def self.merge_conditions(*conditions)
segments = []
conditions.each do |condition|
unless condition.blank?
sql = sanitize_sql(condition)
segments << sql unless sql.blank?
end
-----> Heroku receiving push
-----> Rails app detected
-----> Detected Rails is not set to serve static_assets
Installing rails3_serve_static_assets... done
-----> Gemfile detected, running Bundler version 1.0.0
Unresolved dependencies detected; Installing...
/usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:49:in `initialize': not in gzip format (Zlib::GzipFile::Error)
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:49:in `new'
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:49:in `initialize'
from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader.rb:63:in `each'
class Location < ActiveRecord::Base
searchable do
location :coordinates
end
def coordinates
Sunspot::Util::Coordinates.new(self.lat,self.lng)
end
def coordinates=(sunspot_util_coordinates)
self.lat,self.lng = [sunspot_util_coordinates.lat, sunspot_util_coordinates.lng]
end
NoMethodError: undefined method 'coordinates' for <Sunspot::DSL::Fields:...>
Location.search {with(:coordinates).near(42.331527,-83.075953)}
rm -rf ~/.bundle/ ~/.gem/ .bundle/ Gemfile.lock
bundle install
# remove the github gem pointers
gem 'foo', :git => 'github.com/...'
$(document).ready(function(){
if ($('.resize-font').length) {
$(window).resize(resize);
resize();
}
});
function resize() {
// sizeCoefficient lets me decide how big the fonts are.
// 0.75 gives about 10 words per line, which is good design
select * from add_ons
inner join pricing_plans on add_ons.id = pricing_plans.add_on_id
inner join subscriptions on pricing_plans.id = subscriptions.pricing_plan_id
inner join people on people.id = subscriptions.person_id
where people.id = 1
class AddOn < ActiveRecord::Base
has_many :pricing_plans, :dependent => :destroy
end
class PricingPlan < ActiveRecord::Base
has_many :subscriptions
end
class Subscription < ActiveRecord::Base
belongs_to :person