NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
| === ะงะฐััั 1. ะะฑะทะพัะฝะฐั ะธะฝัะพัะผะฐัะธั | |
| == ะะฑัะทะฐัะตะปัะฝะพ ะฟะพัะผะพััะธัะต | |
| http://en.wikipedia.org/wiki/Internet_media_type | |
| http://en.wikipedia.org/wiki/List_of_HTTP_status_codes ะธะปะธ http://www.flickr.com/photos/girliemac/sets/72157628409467125 | |
| http://api.rubyonrails.org/classes/ActionDispatch/Response.html | |
| http://api.rubyonrails.org/classes/ActionDispatch/Request.html | |
| == ะะพะบัะผะตะฝัะฐัะธั ะฟะพ AJAX ะฒ jQuery |
| === ะงะฐััั 1. ะะฑะทะพัะฝะฐั ะธะฝัะพัะผะฐัะธั | |
| == ะะฑัะทะฐัะตะปัะฝะพ ะฟะพัะผะพััะธัะต | |
| http://en.wikipedia.org/wiki/Internet_media_type | |
| http://en.wikipedia.org/wiki/List_of_HTTP_status_codes ะธะปะธ http://www.flickr.com/photos/girliemac/sets/72157628409467125 | |
| http://api.rubyonrails.org/classes/ActionDispatch/Response.html | |
| http://api.rubyonrails.org/classes/ActionDispatch/Request.html | |
| == ะะพะบัะผะตะฝัะฐัะธั ะฟะพ AJAX ะฒ jQuery |
| class ApplicationController < ActionController::Base | |
| # Creates an accessor which is exposed to the view | |
| def self.view_accessor(*names) | |
| attr_accessor *names | |
| helper_method *names | |
| end | |
| end |
| desc 'rolls back migrations in current branch not present in other' | |
| task :rollback_branch_migrations, [:other_branch] do |t, args| | |
| load "#{Dir.pwd}/Rakefile" | |
| branch_migrations = BranchMigrations.new(args.other_branch) | |
| puts ['Rollback the following migrations', branch_migrations, 'y,n? '] | |
| next if %w[no n NO N].include?(STDIN.gets.chomp) | |
| Rake::Task['environment'].invoke |
| require 'openssl' | |
| class String | |
| CIPHER_NAME = 'aes-256-cbc'.freeze | |
| PBKDF_ITER = 200_000 | |
| KEY_LEN = 32 # 256 bits | |
| SALT_CONST = "fixed-global-salt-v1".freeze | |
| IV_SALT_CONST = "fixed-iv-salt-v1".freeze | |
| def encrypt(password) |
| class Foo | |
| attr_reader :bar | |
| def initialize | |
| @bar = 123 | |
| ObjectSpace.define_finalizer( self, self.class.finalize(bar) ) | |
| end | |
| def self.finalize(bar) | |
| proc { puts "DESTROY OBJECT #{bar}" } | |
| end |
| class Runner | |
| def run(&block) | |
| begin | |
| instance_exec(&block) | |
| @on_success.call if @on_success | |
| rescue Exception => ex | |
| @on_failure.call(ex) if @on_failure | |
| end | |
| end |
| # An abstract base class used to create simple serializers | |
| # for ActiveRecord objects | |
| class BaseSerializer | |
| include Rails.application.routes.url_helpers | |
| attr_reader :serialized_object | |
| def initialize(serialized_object) | |
| @serialized_object = serialized_object | |
| end |
NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
| unless File.exist?('Gemfile') | |
| File.write('Gemfile', <<-GEMFILE) | |
| source 'https://rubygems.org' | |
| gem 'rails', :github => 'rails/rails' | |
| gem 'sqlite3' | |
| GEMFILE | |
| system 'bundle' | |
| end |