Send email asynchroniously using Sidekiq.
Create your mailer us usual:
| class Payment < ActiveRecord::Base | |
| def self.filtered(restrictions) | |
| PaymentFilter.new(self.scoped).restrict(restrictions) | |
| end | |
| def self.year(year) | |
| where(:year => year) | |
| end | |
| def self.person_id(person_id) |
| module Abilities | |
| def self.ability_for(user) | |
| if user.admin? | |
| AdminAbility.new(user) | |
| else user | |
| MemberAbility.new(user) | |
| else | |
| GuestAbility.new | |
| end | |
| end |
| #!/usr/bin/env bash | |
| apt-get -y update | |
| apt-get install build-essential | |
| apt-get -y install zlib1g-dev libssl-dev libreadline5-dev libyaml-dev | |
| apt-get install gcc | |
| cd /tmp | |
| wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.gz | |
| tar -xvzf ruby-1.9.3-p374.tar.gz | |
| cd ruby-1.9.3-p374/ | |
| ./configure --prefix=/usr/local |
| # Call scopes directly from your URL params: | |
| # | |
| # @products = Product.filter(params.slice(:status, :location, :starts_with)) | |
| module Filterable | |
| extend ActiveSupport::Concern | |
| module ClassMethods | |
| # Call the class methods with the same name as the keys in <tt>filtering_params</tt> | |
| # with their associated values. Most useful for calling named scopes from |
| var loops = 1e8, | |
| foo; | |
| console.time('typeof'); | |
| while(loops--) { | |
| if( typeof foo !== 'undefined' ) {} | |
| } | |
| console.timeEnd('typeof'); | |
| loops = 1e8; |
| In addition, here is the code I used for the solution Chris suggested, for anyone interested. | |
| # /models/concerns/location_validations.rb | |
| module LocationValidations | |
| extend ActiveSupport::Concern | |
| included do | |
| validates :name, presence: true | |
| validates :address, presence: true | |
| validates :state, presence: true |
| Case | |
| def set_pay_plan | |
| progress = self.progress | |
| case progress | |
| when 0.01..0.74 | |
| self.pay_plan = "s-20" | |
| when 0.75..0.84 | |
| self.pay_plan = "s-225" | |
| when 0.85..1.05 |
| require 'rails_helper' | |
| RSpec.describe TodosController, :type => :controller do | |
| context "GET index" do | |
| #context "POST create" do | |
| #context "GET show" do | |
| #context "PATCH update" do (or PUT update) | |
| #context "DELETE destroy" do | |
| #context "GET new" do |
| #!/usr/bin/env bash | |
| curl https://s3.amazonaws.com/heroku-jvm-buildpack-vi/vim-7.3.tar.gz --output vim.tar.gz | |
| mkdir vim && tar xzvf vim.tar.gz -C vim | |
| export PATH=$PATH:/app/vim/bin |