Skip to content

Instantly share code, notes, and snippets.

def update
update! do |format|
format.html { redirect_to admin_cars_path }
end
end
@cpfarher
cpfarher / gist:7094269
Last active February 19, 2016 02:50
Error in history with paper trail in active_admin
SyntaxError in Admin::Formulas#history
Showing /home/christian/public_html/rails/cr/app/views/layouts/history.html.arb where line #1 raised:
/home/christian/public_html/rails/cr/app/views/layouts/history.html.arb:1: syntax error, unexpected '<'
...::Context.new(assigns, self){ <%
... ^
/home/christian/public_html/rails/cr/app/views/layouts/history.html.arb:3: syntax error, unexpected tIDENTIFIER, expecting '}'
table_for assigns[:versions]
^
/home/christian/public_html/rails/cr/app/views/layouts/history.html.arb:4: syntax error, unexpected keyword_end, expecting '}'
@cpfarher
cpfarher / deploy.rb
Created November 21, 2013 22:48
Deploy con capistrano
set :application, 'myapp'
set :scm, :git
set :repository, 'git@bitbucket.org:repo/myapp.git'
set :branch, "master"
set :use_sudo, false
set :deploy_via, :copy
namespace :deploy do
desc 'Restart application'
** Execute deploy:assets:precompile
DEBUG [caad213e] Running if test ! -d /home/christian/myapp/releases/20131204233131; then echo "Directory does not exist '/home/christian/myapp/releases/20131204233131'" 1>&2; false; fi on bys-intranet.zapto.org
DEBUG [caad213e] Command: if test ! -d /home/christian/myapp/releases/20131204233131; then echo "Directory does not exist '/home/christian/myapp/releases/20131204233131'" 1>&2; false; fi
DEBUG [caad213e] Finished in 1.174 seconds with exit status 0 (successful).
INFO [5c2dd7c5] Running ~/.rvm/bin/rvm ruby-1.9.3-p484 do rake assets:precompile on bys-intranet.zapto.org
DEBUG [5c2dd7c5] Command: cd /home/christian/myapp/releases/20131204233131 && ( RVM_BIN_PATH=~/.rvm/bin RAILS_ENV=production ~/.rvm/bin/rvm ruby-1.9.3-p484 do rake assets:precompile )
DEBUG [5c2dd7c5] rake aborted!
DEBUG [5c2dd7c5]
DEBUG [5c2dd7c5] PG::UndefinedTable: ERROR: no existe la relación «product_stocks»
DEBUG [5c2dd7c5]
@cpfarher
cpfarher / gist:7798135
Last active December 30, 2015 07:49
Rails 4.0.0. Ruby 1.9.3 y Capistrano 3. Usando require 'capistrano/rails' en capfile
christian@toshichri:~/public_html/rails/myapp$ cap production deploy --trace
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke deploy (first_time)
** Execute deploy
** Invoke deploy:starting (first_time)
** Invoke deploy:set_shared_assets (first_time)
** Execute deploy:set_shared_assets
# Load DSL and Setup Up Stages
require 'capistrano/setup'
# Includes default deployment tasks
require 'capistrano/deploy'
# Includes tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
@cpfarher
cpfarher / designer.html
Last active August 29, 2015 14:11
designer
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../paper-ripple/paper-ripple.html">
<link rel="import" href="../paper-toast/paper-toast.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<link rel="import" href="../core-menu-button/core-menu-button.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
require 'timers'
timers_scan = Timers::Group.new
scan=[3.0]
scan_started=[]
sleep_time=4.0
last_time=Time.now.to_f
loop {
@cpfarher
cpfarher / 01-Notas.md
Last active August 29, 2015 14:25 — forked from mariochavez/01-Notas.md
Usando Docker con Rails

Usando Docker con Rails para hacer deploy a Producción

Instalar Docker

Hay que seguir las notas en https://docs.docker.com/installation/ para el sistema operativo que esten ejecutando.

Utilizando un contenedor para Postgresql

Vamos a utilizar un container ya listo para trabajar con Postgresql. El siguiente comando se encarga de descargar el container y de ejecutarlo. Si es necesario cambiar el valor de las variables POSTGRES_PASSWORD y POSTGRES_USER a unos más adecuados

$ docker run --name db -e POSTGRES_PASSWORD=manager -e POSTGRES_USER=rails -d postgres
@cpfarher
cpfarher / deployment-tool-ansible-puppet-chef-salt.md
Created August 23, 2017 12:17 — forked from jaceklaskowski/deployment-tool-ansible-puppet-chef-salt.md
Choosing a deployment tool - ansible vs puppet vs chef vs salt

Requirements

  • no upfront installation/agents on remote/slave machines - ssh should be enough
  • application components should use third-party software, e.g. HDFS, Spark's cluster, deployed separately
  • configuration templating
  • environment requires/asserts, i.e. we need a JVM in a given version before doing deployment
  • deployment process run from Jenkins

Solution