Skip to content

Instantly share code, notes, and snippets.

View nsanta's full-sized avatar

Nicolas Santa nsanta

  • Rio Cuarto, Cordoba, Argentina
View GitHub Profile
def copy
@account_profile = AccountProfileTemplate.find(params[:based_on])
@account_profile = AccountProfileTemplate.new(@account_profile.attributes.merge(:name => params[:name]))
respond_to do |format|
if @account_profile.save
flash[:notice] = "The Account Profile has been copied"
format.js{redirect_to admin_account_profiles_path}
else
flash[:notice] = "The Account Profile has NOT been copied"
format.js{redirect_to admin_account_profiles_path}
@nsanta
nsanta / gist:188604
Created September 17, 2009 17:28 — forked from bscofield/gist:181842
# mongo_template.rb
# remove unneeded defaults
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/javascripts/controls.js"
run "rm public/javascripts/dragdrop.js"
run "rm public/javascripts/effects.js"
run "rm public/javascripts/prototype.js"
accepts_nested_attributes_for :rfx_event_members ,
:reject_if => proc{|attributes| attributes[:role].blank? || attributes[:user_id].blank?}
def reject_new_record?(association_name, attributes)
has_delete_flag?(attributes) ||
self.class.reject_new_nested_attributes_procs[association_name].try(:call, attributes)
end
NameError in Account/contactsController#index
uninitialized constant Account::ContactsController
RAILS_ROOT: /home/nicolas/projects/finario
Application Trace | Framework Trace | Full Trace
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:105:in `const_missing'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/inflector.rb:361:in `constantize'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/inflector.rb:360:in `each'
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe Album do
before :each do
@website = Factory(:website)
@album = @website.albums.build(Factory(:album).attributes)
@album.save
end
it "should be valid" do
@album.should be_valid
file 'Gemfile', <<-GEMS
source 'http://gemcutter.org'
gem "rails", "3.0.0.beta4"
gem "bson_ext"
gem "mongoid", "2.0.0.beta4"
gem "haml", "3.0.0.rc.2"
gem "compass", "0.10.0.rc4"
gem "inherited_resources"
group :test do
# A sample Gemfile
source :rubyforge
#
gem "rails" , '2.3.5'
gem 'mongrel'
gem 'ruby-debug'
gem 'mysql'
gem "clearance"
gem "whenever"
gem 'haml', '>=2.2.0'
/home/nicolas/projects/helloworld/vendor/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:105:in `const_missing': uninitialized constant Redis::Namespace (NameError)
from /home/nicolas/projects/helloworld/vendor/ruby/1.8/gems/resque-1.9.9/lib/resque.rb:36:in `redis='
from /home/nicolas/helloworld/promojam/config/initializers/resque.rb:5
require 'resque_scheduler'
rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
rails_env = ENV['RAILS_ENV'] || 'development'
resque_config = YAML.load_file(rails_root + '/config/resque.yml')
Resque.redis = resque_config[rails_env]
Resque.schedule = YAML.load_file(File.join(File.dirname(__FILE__), '../resque_schedule.yml'))
Dir[File.join("app","jobs", "*.rb")].each {|file| require file }
class String
@nsanta
nsanta / gist:701152
Created November 15, 2010 23:14
moron css
html, body {height:100%;}
body * {font-family: "Helvetica Neue", Helvetica, "Century Gothic", Verdana, Arial, sans-serif;}
h1 , h2, h3, h4, h5, h6 {font-weight:bold;}
h1 { font-size: 2em; margin: 10px 0;}
h2 { font-size: 1.5em; margin: 10px 0;}
h3 { font-size: 1.17em; margin: 10px 0;}
h4 { font-size: 1em; margin: 10px 0;}
h5 { font-size: 0.8em; margin: 10px 0;}
h6 { font-size: 0.5em; margin: 10px 0;}
.font_sm {font-size:10px;}