Skip to content

Instantly share code, notes, and snippets.

View angelsystem's full-sized avatar

angel roberto angelsystem

View GitHub Profile
@angelsystem
angelsystem / gist:3670492
Created September 7, 2012 22:56
error rspec
al ejecutar rspec spec/request/posts_pages_spec.rb --format doc
/Users/angelito/.rvm/gems/ruby-1.9.3-p194@mysql2/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load': cannot load such file -- /Users/angelito/Developement/eternia/myblog/spec/request/posts_pages_spec.rb (LoadError)
from /Users/angelito/.rvm/gems/ruby-1.9.3-p194@mysql2/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `block in load_spec_files'
from /Users/angelito/.rvm/gems/ruby-1.9.3-p194@mysql2/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
from /Users/angelito/.rvm/gems/ruby-1.9.3-p194@mysql2/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
from /Users/angelito/.rvm/gems/ruby-1.9.3-p194@mysql2/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
from /Users/angelito/.rvm/gems/ruby-1.9.3-p194@mysql2/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in `run'
from /Users/angelito/.rvm/gems/ruby-1.9.3-p194@mysql2/gems/rspec-core-2.11.1/lib/rspec/
@angelsystem
angelsystem / mongoid.yml
Created September 7, 2012 23:16
Rails and MongoDB
To use multiple MongoDB database through Mongoid use set_database inside the Mongoid model to set the database
module Cache
class Inquiry
include Mongoid::Document
set_database :cache
...
And add the configuration for :cache to mongoid.yml
@angelsystem
angelsystem / uploads.js.coffee.erb
Created December 11, 2012 21:42
translate javascript js.coffee.erb
$("strong.column#{oldvalue}").text "<%= I18n.t('frontend.import.column') %>#{oldvalue}"
@angelsystem
angelsystem / gist:6425584
Created September 3, 2013 15:40
Get tax.
#view
= select_tag "paisorigen", id: "country", "<option value=':PEN' >Perú</option> <option value=':COP'>Colombia</option><option value=':MXN'>Mexico</option><option value=':USD'>Otros</option>".html_safe, :include_blank => true, :class => "chosen required", :style => "padding: 8px 0px 0px 5px;width: 120px;margin: 18px 0px 4px 15px;", :required => "required "
#javascript
$(document).on 'change','select#country',(event) ->
target = $('#donde_se_va_mostrar')
country_code = $(@).val()
url = "/my_controller/my_method?country_code=#{country_code}"
target.load(url)
before_filter :load_resource_unit
before_filter :load_resource_budget, only: [:show, :edit, :update, :action_exception]
authorize_resource :unit
authorize_resource :budget, except: [:new, :create, :asign_clients, :save_clients]
authorize_resource :budget, through: :unit, only: [:new, :create, :destroy]
def load_resource_budget
@budget = Budget.find params[:id]
# encoding : UTF-8
def credito(monto, tasa, nombre, ruc)
puts "El monto maximo sera de " + monto.to_s
puts "La tasa sera de " + tasa.to_s
puts nombre
puts ruc
end
puts "Ingrese la razón social"
nombre = gets.chomp
= simple_form_for(@couple, url: save_family_clients_url, html: { multipart: true, id: 'form_modal_family', novalidate: true}, remote: true) do |f|
.head-modal
%p Asignacion de pareja
.body-modal.scroll-wrapp
= hidden_field_tag "parent", @parent.id
- if @parent.marital_status == 'M'
%fieldset
%legend Régimen de Propiedad
= f.input :married_regimen do
= f.select :married_regimen, [['Bienes Mancomunados', Client::REGIMENS[:community_property]], ['Bienes Separados', Client::REGIMENS[:separate_property]]]
@angelsystem
angelsystem / gist:7932465
Last active December 31, 2015 04:09
delayed job hooks
class Newsletter < ActiveRecord::Base
def deliver
sleep 5 # simulate long newsletter delivery
update_attribute(:delivered_at, Time.zone.now)
end
handle_asynchronously :deliver
end
===============
#lib/startup_constraint.rb
class StartupConstraint
def matches?(request)
id = request.path.gsub("/", "")
Startup.find_by_slug(id)
end
end
#lib/user_constraint.rb
class UserConstraint
- show ||= 'cards'
- if show == 'list'
= div_for user, class: 'user-list' do
.user-description
.user-avatar
= avatar(user, class: "user-img")
.user-info
= link_to user.name, "", class: "name"
%p.role= user.role_name