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
# encoding: utf-8 | |
gem 'sqlite3', '1.3.6' | |
gem 'activerecord', '3.2.8' | |
gem 'squeel', '1.0.11' | |
require 'active_record' | |
require 'squeel' | |
require 'squeel/version' |
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
# encoding: utf-8 | |
gem 'sqlite3', '1.3.6' | |
gem 'activerecord', '3.2.8' | |
require 'active_record' | |
require 'logger' | |
puts "Active Record #{ActiveRecord::VERSION::STRING}" |
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
# encoding: utf-8 | |
class AlbumForm < BaseForm | |
has_many :songs, class_name: 'SongForm' | |
validates :songs, form_collection: true | |
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
# encoding: utf-8 | |
class Context | |
def sanitize_sql(array) | |
self.class.sanitize_sql(array) | |
end | |
def select_all(sql) | |
self.class.select_all(sql) |
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
# encoding: utf-8 | |
class Context | |
class Context::Result | |
def initialize(*args, &block) | |
args.extract_options!.each do |attr, value| | |
send("#{attr}=", numeric?(value)) if respond_to?("#{attr}=") | |
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
# encoding: utf-8 | |
class Article | |
attr_accessor :title, :body | |
def initalize(title, body) | |
self.title = title | |
self.body = body | |
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
# encoding: utf-8 | |
require 'heroku-api' | |
namespace :heroku do | |
desc "Scale down the processes during business hours" | |
task :spin_down => :environment do | |
app = ENV['HEROKU_APP'] | |
heroku = Heroku::API.new(:api_key => ENV['HEROKU_API_KEY']) |
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
# encoding: UTF-8 | |
class Email < ActiveRecord::Base | |
has_attached_file :raw | |
after_save :remove_file | |
# =========================================================================== | |
# Public instance methods |
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
# encoding: utf-8 | |
class StringFile < StringIO | |
def initialize(file_content, file_name, file_type) | |
super(file_content) | |
@file_name = file_name | |
@file_type = file_type | |
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
def data | |
@data ||= File.read pdf_template_path | |
end | |
def pdf_template_path | |
@tmp_path ||= @pdf_template.template.tap { |u| u.cache_stored_file! }.path | |
end | |
def cleanup | |
File.delete(pdf_template_path) if File.exist?(pdf_template_path) |
OlderNewer