This file contains hidden or 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
class HogeModel | |
# fugaにマッチしたカラムの返却 | |
def fuga_columns | |
self.attributes.keys.select { |a| a.match(/fuga/) } | |
end | |
end |
This file contains hidden or 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
gem 'newrelic_rpm' |
This file contains hidden or 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
class ErrorsController < ActionController::Base | |
NOT_FOUND = 404 | |
STANDARD_ERROR = 500 | |
rescue_from StandardError, with: :error_500 | |
rescue_from AbstractController::ActionNotFound, with: :render_404 | |
rescue_from ActionController::RoutingError, with: :render_404 | |
layout false |
This file contains hidden or 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
class Model < ActiveRecord::Base | |
has_many :users | |
def as_json(options={}) | |
super.as_json(options).merge({users: self.users}) | |
end | |
end |
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
NewerOlder