Skip to content

Instantly share code, notes, and snippets.

@apneadiving
apneadiving / users_controller.rb
Created January 20, 2012 00:25
gmaps4rails: Don't show map by default and load markers with ajax
class UsersController < ApplicationController
respond_to :html, :json
def index
@json = User.all.to_gmaps4rails
respond_with @json
end
end
@apneadiving
apneadiving / deploy.rb
Created October 31, 2011 17:19
basic capistrano script
require 'yaml'
CAP = YAML.load_file("./config/deploy.yml")
require "bundler/capistrano"
set :bundle_cmd, "/usr/local/rvm/gems/ree-1.8.7-2011.03/bin/bundle"
set :bundle_without, [:development, :test]
default_run_options[:pty] = true # Must be set for the password prompt from git to work
set :repository, CAP["repository"] # Your clone URL
@apneadiving
apneadiving / refinery_patch.rb
Created October 8, 2011 19:10
to use Refinery with your custom devise configuration in Rails 3.1
module RefineryPatch
def self.included(base)
base.send :helper_method,
:current_refinery_user,
:refinery_user_signed_in?,
:refinery_user? if base.respond_to? :helper_method
end
def current_refinery_user