ChangeLog を書く際によく使われる英語をまとめました。
ほとんど引用です。
# -*- coding: utf-8 -*- | |
class FreezeValidator < ActiveModel::EachValidator | |
def initialize(options) | |
options[:unless] = Array.wrap(options[:unless]) | |
options[:unless] << :new_record? | |
super | |
end | |
def validate_each(record, attribute, value) |
source 'https://rubygems.org' | |
gem 'sinatra' | |
gem 'puma' | |
gem 'thin' |
# -*- coding: utf-8 -*- | |
require 'active_support/core_ext' | |
class Hash | |
def camelize_keys(first_letter = :upper) | |
dup.camelize_keys!(first_letter) | |
end | |
def camelize_keys!(first_letter = :upper) |
blink { | |
-webkit-animation: blink 1.0s infinite; | |
-moz-animation: blink 1.0s infinite; | |
animation: blink 1.0s infinite; | |
} | |
@-webkit-keyframes blink { | |
0% { opacity: 1.0; } | |
50% { opacity: 1.0; } | |
51% { opacity: 0.0; } |
module TableFucking | |
extend ActiveSupport::Concern | |
included do | |
self.table_name = 'prefix_' + name.match(/\APrefix(.+)\Z/)[1].underscore | |
columns = connection.columns(table_name) | |
reserved_words = ActiveRecord::Base.instance_methods | |
columns.each do |column| |
# -*- coding: utf-8 -*- | |
class PostController < ApplicationController | |
before_filter :require_post, only: [:show, :edit, :update, :destroy] | |
def index | |
@posts = posts | |
end | |
def new |
# -*- coding: utf-8 -*- | |
module ValidationContext | |
extend ActiveSupport::Concern | |
included do | |
before_validation :reflect_context_to_associations | |
end | |
# @return [Symbol] |
<div class="container clearfix" style="overflow-x: auto; width: 900px;"> | |
<div class="sub-container" style="width: <%= @parts.size * 300 %>px;"> | |
<% @parts.each do |part| %> | |
<div class="parts pull-left" style="width: 300px;">...</div> | |
<% end %> | |
</div> | |
</div> |