Skip to content

Instantly share code, notes, and snippets.

@bmsolutions
bmsolutions / cashadvance.rb
Created March 16, 2011 16:47
Merchant Show
class Cashadvance < ActiveRecord::Base
belongs_to :merchant, :inverse_of => :cashadvances
has_many :payments
validates_presence_of :start_date, :factor_rate, :advance_amount, :expected_duration, :merchant
before_create :verify_zero_owed
def payback_amount
advance_amount * factor_rate
end
@bmsolutions
bmsolutions / gist:811409
Created February 4, 2011 17:23
return false from filter
class ProfilesController < ApplicationController
before_filter :set_current_account
def index
@hours = BusinessHour.find_hours_for_id(@business.id)
@services = Service.find_services_for_business(@business.id)
@staffs = Staff.find_staff_for_business(@business.id)
respond_to do |format|
source 'http://rubygems.org'
gem 'rails', '3.0.1'
gem 'authlogic'
gem 'switch_user'
gem 'acts_as_versioned'
gem 'jquery-rails', '>= 0.2.6'
gem 'capistrano'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
[general]
enable=yes
[csv]
usegmtime=no
loguniqueid=yes
@bmsolutions
bmsolutions / gist:632469
Created October 18, 2010 15:54
rails install error with rvm
gem install rails -v 2.3.8
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
yonahw@yonahw-work:~$ rvm info
ruby-1.8.7-p302:
system:
@bmsolutions
bmsolutions / gist:632459
Created October 18, 2010 15:48
gem install error - rvm
gem install rails -v 2.3.8
/home/yonahw/.rvm/rubies/ruby-1.8.7-p302/bin/gem:13:in `require': no such file to load -- rubygems (LoadError)
from /home/yonahw/.rvm/rubies/ruby-1.8.7-p302/bin/gem:13
rvm info
ruby-1.8.7-p302:
system:
class Merchant < ActiveRecord::Base
has_many :cashadvances
accepts_nested_attributes_for :cashadvances
end
class Cashadvance < ActiveRecord::Base
belongs_to :merchant
end
We couldn’t find that file to show.
class ClassProjectsController < ApplicationController
def new
end
end