ActiveRecordのModelに include
することで簡単にソート順(order
)を指定できるようになります。
すごく複雑な条件とかは全然考慮してません。
Railsなら上記の sortable.rb
を lib
に配置。
ActiveRecordを継承したModelに対して include
を行います。
class User < ActiveRecord::Base
./configure \ | |
--enable-mbstring \ | |
--enable-mbregex \ | |
--with-mcrypt \ | |
--with-gd \ | |
--with-libdir=lib64 \ | |
--enable-bcmath \ | |
--with-apxs2=/usr/local/apache2/bin/apxs \ | |
--disable-debug \ | |
--with-mysql=/usr/bin \ |
./configure \ | |
--enable-ssl=shared \ | |
--enable-rewrite=shared \ | |
--enable-headers=shared \ | |
--with-pdo-mysql=shared \ | |
--enable-so \ | |
--with-mpm=prefork |
# 複数のAjax通信を行って全ての結果がそろったら次の処理を実行したい等の場合 | |
# Ajax処理 | |
somethingAjax1: -> | |
dfd = $.Deferred() | |
$.getJSON '/something.json', {'param': param }, (data) => | |
# dataを使った処理をする | |
# 無事完了したらresolve() | |
dfd.resolve() |
# require 'rubyzip.gem' | |
require 'zip/zip' | |
tmp_file_path = '/path/to/great_presentation.pptx' | |
Zip::ZipFile.open(tmp_file_path) do |zip| | |
zip.each do |f| | |
next unless f.name =~ /\AdocProps\/core\.xml\Z/ | |
doc = ::REXML::Document.new(zip.read(f.name)) |
schema.rb を廃止して structure.sql に変更、更に parallel_tests を導入した場合の .travis.yml。(抜粋) structure.sql を直接あててるのは prepare だとなぜか入らないため。(詳しく追ってない)
GRANT SELECT, CREATE TEMPORARY TABLES ON DATABASE_NAME.* TO `DATABASE_NAME_r`@"192.168.%" IDENTIFIED BY ''; | |
GRANT PROCESS ,SHOW DATABASES ON *.* TO `DATABASE_NAME_r`@"192.168.%" IDENTIFIED BY ''; | |
GRANT ALTER, DELETE, INDEX, INSERT, SELECT ,UPDATE ,CREATE, DROP, CREATE TEMPORARY TABLES, LOCK TABLES, CREATE VIEW, SHOW VIEW ON `DATABASE_NAME`.* TO `DATABASE_NAME_rw`@"192.168.%" IDENTIFIED BY 'XXXXXXXXX'; | |
GRANT PROCESS ,SHOW DATABASES ON *.* TO `DATABASE_NAME_rw`@"192.168.%" IDENTIFIED BY 'XXXXXXXXXX'; | |
FLUSH PRIVILEGES; |
# Master image | |
FROM centos | |
# Use Epel | |
RUN rpm -ivh http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
# Install middleware | |
RUN yum -y update | |
RUN yum install -y which tar patch libffi-devel glibc-headers autoconf gcc-c++ glibc-devel patch readline-devel zlib-devel openssl-devel bzip2 automake libtool bison | |
RUN yum install -y libyaml libyaml-devel libxml2 libxml2-devel libxslt libxslt-devel |