This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
before_filter :collect_http_referrer | |
def collect_http_referrer | |
session[:http_referrer] ||= request.env["HTTP_REFERER"] | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rails g active_admin:install | |
invoke devise | |
generate devise:install | |
create config/initializers/devise.rb | |
create config/locales/devise.en.yml | |
=============================================================================== | |
Some setup you must do manually if you haven't yet: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Jay's additions to Active Admin: | |
$(document).ready(function() { | |
function changeSubcategories(selection) { | |
// entrance_page = $("#title_bar a:eq(2)").text(); | |
data = { 'data': selection } //, 'entrance_page': ent } | |
$.post("/get_subcategories", data); | |
} | |
//changeSubcategories(); | |
$("#entrance_page_source_category_id").change(function() { | |
changeSubcategories($("#entrance_page_source_category_id option:selected").text()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/Sites/example$ cap deploy:migrations ✹master ‹ruby-1.9.2@rails31› | |
triggering start callbacks for `deploy:migrations' | |
* 11:44:19 == Currently executing `multistage:ensure' | |
*** Defaulting to `staging' | |
* 11:44:19 == Currently executing `staging' | |
* 11:44:19 == Currently executing `deploy:migrations' | |
* 11:44:19 == Currently executing `deploy:update_code' | |
updating the cached checkout on all servers | |
executing locally: "git ls-remote git@github.com:sandboxindustries/example.git master" | |
command finished in 1119ms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'capistrano/ext/multistage' | |
require "bundler/capistrano" | |
require "delayed/recipes" | |
require 'capistrano_colors' | |
# multistage ---------------- | |
set :stages, %w(staging production) | |
set :default_stage, "staging" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
before_filter :fix_accept_header | |
protected | |
def fix_accept_header | |
request.format = :html unless Mime::SET.map(&:symbol).include?(request.format.to_sym) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if @result.credit_card_verification | |
@account.transactions.build( | |
:approved => false, | |
:avs_error_response_code => @result.credit_card_verification.avs_error_response_code, | |
:avs_postal_code_response_code => @result.credit_card_verification.avs_postal_code_response_code, | |
:avs_street_address_response_code => @result.credit_card_verification.avs_street_address_response_code, | |
:cvv_response_code => @result.credit_card_verification.cvv_response_code, | |
:gateway_rejection_reason => @result.credit_card_verification.gateway_rejection_reason, | |
:processor_response_code => @result.credit_card_verification.processor_response_code, | |
:processor_response_text => @result.credit_card_verification.processor_response_text, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("form#whatever").submit(function() { | |
$(this).submit(function() { | |
return false; | |
}); | |
return true; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Redis configuration file example | |
# Note on units: when memory size is needed, it is possible to specifiy | |
# it in the usual form of 1k 5GB 4M and so forth: | |
# | |
# 1k => 1000 bytes | |
# 1kb => 1024 bytes | |
# 1m => 1000000 bytes | |
# 1mb => 1024*1024 bytes | |
# 1g => 1000000000 bytes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spork' | |
Spork.prefork do | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
require 'capybara/rspec' | |
require 'database_cleaner' | |
Spork.trap_method(Rails::Application, :reload_routes!) | |
Spork.trap_method(Rails::Application::RoutesReloader, :reload!) |
OlderNewer