Skip to content

Instantly share code, notes, and snippets.

View captproton's full-sized avatar

captproton captproton

View GitHub Profile
@captproton
captproton / gist:975705
Created May 17, 2011 01:23
attribute_methods_generated
ActionView::Template::Error (undefined method `attribute_methods_generated?' for nil:NilClass):
1: <%= form_for @animal do |f| %>
2: <%# semantic_form_for @animal do |f| %>
3: <div class="field">
4: <%= f.label :name %><br />
app/views/animals/_form.html.erb:1:in `_app_views_animals__form_html_erb___482318500_2194510580_876190'
app/views/animals/new.html.erb:3:in `_app_views_animals_new_html_erb__918187083_2194607340_0'
app/controllers/animals_controller.rb:29:in `new'
@captproton
captproton / gist:935360
Created April 21, 2011 20:11
bad heroku push
$ git push production master
! Heroku Git error, try again shortly
! We've been notified, see http://support.heroku.com if the problem persists
fatal: The remote end hung up unexpectedly
@captproton
captproton / gist:861508
Created March 9, 2011 01:23
suspenders and RedCloth on Mac
$ rake test
(in /Users/heathertanner/Sites/mouseMenus/mousemenus)
rake aborted!
dlopen(/opt/local/lib/ruby/gems/1.8/gems/RedCloth-4.2.7/lib/redcloth_scan.bundle, 9): no suitable image found. Did find:
/opt/local/lib/ruby/gems/1.8/gems/RedCloth-4.2.7/lib/redcloth_scan.bundle: mach-o, but wrong architecture - /opt/local/lib/ruby/gems/1.8/gems/RedCloth-4.2.7/lib/redcloth_scan.bundle
Couldn't load redcloth_scan
The $LOAD_PATH was:
/opt/local/lib/ruby/gems/1.8/gems/will_paginate-2.3.15/lib
/opt/local/lib/ruby/gems/1.8/gems/validation_reflection-1.0.0/lib
/opt/local/lib/ruby/gems/1.8/gems/timecop-0.3.5/lib
@captproton
captproton / nokogiri_wont_install
Created March 8, 2011 18:01
pick another gemset besides system, and nokogiri won't install
$ gem install nokogiri
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/heathertanner/.rvm/rubies/ruby-1.9.1-p378/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
@captproton
captproton / gist:766622
Created January 5, 2011 17:23
heroku won't take a mysql db:push
$ heroku db:push --app stark-waterfall-455 --confirm stark-waterfall-455
Loaded Taps v0.3.14
Auto-detected local database: mysql://root:root@localhost/sponsorpitch_production?encoding=utf8
Warning: Data in the app 'stark-waterfall-455' will be overwritten and will not be recoverable.
Failed to connect to database:
Sequel::AdapterNotFound -> LoadError: dlopen(/opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin9/mysql.bundle, 9): Library not loaded: /opt/local/lib/mysql5/mysql/libmysqlclient.15.dylib
Referenced from: /opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin9/mysql.bundle
Reason: image not found - /opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin9/mysql.bundle
@captproton
captproton / adding 301 and 302 redirects to RefineryCMS
Created November 24, 2010 22:50
a tutorial on how to easily add redirects to Refinery CMS
If you have a new site that the search engines don't know about, then Refinery CMS is perfectly set up after the install, but what if you are upgrading a site to Refinery that was based on another technology? Not all of the pages will have the same url's. You will need some redirects to the pages you create or you will lose that precious SEO juice that the previous site worked so hard to get.
One tack to take is to add some middleware, specifically Rack::Rewrite. Here are the three easy steps:
1) install the Rack::Rewrite gem (http://rubygems.org/gems/rack-rewrite)
2) At the bottom of the Gemfile:
# USER DEFINED
gem 'rack-rewrite', '~> 1.0.2'
3) in application.rb:
@captproton
captproton / gist:700842
Created November 15, 2010 19:50
heroku postgresdb backup plugin install error
$ heroku plugins:install git://github.com/heroku/heroku-postgresql.git
There is no candidate for rebasing against among the refs that you just fetched.
Generally this means that you provided a wildcard refspec which had no
matches on the remote end.
Could not install heroku-postgresql. Please check the URL and try again
@captproton
captproton / gist:700760
Created November 15, 2010 18:45
error signing into refinerycms
Started POST "/session" for 98.210.200.138 at Mon Nov 15 10:41:54 -0800 2010
Processing by SessionsController#create as HTML
Parameters: {"commit"=>"Sign in", "continue_editing"=>"false", "session"=>{"remember_me"=>"0", "password"=>"[FILTERED]", "login"=>"captproton"}, "modal"=>"false", "authenticity_token"=>"XrQlWnnZ2DU4YKpZRuROgkdZo/CuaIScK6Y0s9KqHFE=", "utf8"=>"\342\234\223", "locale"=>:en, "dialog"=>"false"}
Completed in 4ms
ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):
def show
render :json => {:taken => username_taken(params[:username])}
end
def username_taken(username)
user = User.where("username = ?", params[:username]).first
if user.present?
return true
NameError in Dashboard#index
Showing /Users/heathertanner/Sites/rails/osskids2/app/views/dashboard/_feed_item.html.erb where line #63 raised:
undefined local variable or method `small' for #<#<Class:0x3d8db0c>:0x3d8cbf8>
Extracted source (around line #63):
60: :loading => "http://l.yimg.com/cc/img/global/1287689716/dash_loader.gif",
61: :original => feed_item.meme.media.url(:medium),
62: :title => feed_item.meme.body.html_safe ,