An incomplete cheatsheet for rails 3. Things are added as they are required.
# http://guides.rubyonrails.org/active_record_validations_callbacks.html
class SomeClass < ActiveRecord::Base
# length| COUNTRIES = [ | |
| "Afghanistan", | |
| "Aland Islands", | |
| "Albania", | |
| "Algeria", | |
| "American Samoa", | |
| "Andorra", | |
| "Angola", | |
| "Anguilla", | |
| "Antarctica", |
| git config --global mergetool.sublime.cmd "subl -w \$MERGED" | |
| git config --global mergetool.sublime.trustExitCode false | |
| git config --global merge.tool sublime | |
| git mergetool -y |
| # Amadeusz Juskowiak <[email protected]> 2012 - MIT License | |
| # 1. Put inside helpers do .. end | |
| # 2. Set CACHE_DIR to somewhere writable and private (like CACHE_DIR=File.dirname(__FILE__) + '/tmp' | |
| # 3. Use it! You can use fragment_expire to remove cache with given name. | |
| # | |
| # Example: | |
| # %h1 foo | |
| # = cache_fragment(:report, 300) do | |
| # - data = get_data_slowly |
| Failures: | |
| 1) Pricing should require circle_vehicle_id to be set | |
| Failure/Error: it { is_expected.to validate_presence_of(field) } | |
| Expected errors to include "muss ausgefüllt werden" when circle_vehicle_id is set to nil, | |
| got no errors | |
| # ./spec/support/model_macros.rb:9:in `block (2 levels) in validates_presence_of' | |
| # ./spec/spec_helper.rb:114:in `block (3 levels) in <top (required)>' | |
| # /Users/andrew/.rvm/gems/ruby-2.2.2@car_share/gems/i18n-0.7.0/lib/i18n.rb:257:in `with_locale' | |
| # ./spec/spec_helper.rb:114:in `block (2 levels) in <top (required)>' |
| class ReduceValidator < ActiveModel::EachValidator | |
| def validate_each(record, attribute, value) | |
| return until record.errors.to_hash.has_key?(attribute) | |
| record.errors[attribute].slice!(-1) until record.errors[attribute].size <= 1 | |
| end | |
| end |
Primary differences between SSH and HTTPS. This post is specifically about accessing Git repositories on GitHub.
plain Git, aka git://github.com/
Does not add security beyond what Git itself provides. The server is not verified.
If you clone a repository over git://, you should check if the latest commit's hash is correct.
| check file slave_running with path /opt/slave_running | |
| if timestamp > 3 minutes then alert |