It can be useful to have a Ruby expression like condition ? positive_case : negative_case in MySQL queries:

makandra dev
ruby-doc.org

[ ] [ ]= ** ! ~ + - * / % + - >> << & ^ | <= < > >= <=> == === != =~ !~ && || .. ... ? : = %= { /= -= += |= &= >>= <<= *= &&= ||= **= defined? not or and if unless while until begin/end For more information see Table 18.4 in The Pragmatic Programmer's...

A good tool to generate strong passwords and secrets is "apg". You can get it with sudo apt-get install...

github.com

Ruby gem that provides an AR-style interface for the Pivotal Tracker API.

You need to install the following packages before you can build the Paperclip gem: sudo apt-get install imagemagick librmagick...

makandra dev

A popular ruby idiom I keep stumbling upon is def do_some_thing_for(values) values = Array(values)

You can use record.send(:update_without_callbacks) or record.send(:create_without_callbacks) This can be used as a...

makandra dev

You don't need a Rails application to use Sass. Even when you're working on a static site you...

Find conditions for scopes can be given either as an array (:conditions => ['state = ?', 'draft']) or a hash (:conditions => { 'state' => 'draft...

youtube.com

power-rake db:migrate VERSION=20100913132321 By default the environments development, test, cucumber and performance are considered...

There are many different methods that allow mapping an Array to a Hash in Ruby. Array#to_h with a...

makandra dev
robots.thoughtbot.com

Getting started with Ruby extensions in C.

makandra dev

If you want to rename a key of a Ruby hash, this could help you out. Just put it into...

github.com

delocalize provides localized date/time and number parsing functionality for Rails.

First of all: You could just use RVM which would make the pain go away. If for some reason you...

github.com

You can use the whatlanguage gem to detect the language of a Ruby string. Note that it also has not...

github.com

This gem is designed to provide CSS views to Rails, and a process to concatenate and minify these files to...

Call with the server's hostname (and user if you have no SSH agent), e.g. install-gems-remotely my.server.com

makandra dev

There are two distinct ways of commenting Haml markup: HTML and Ruby. HTML comments This will create an HTML comment...

makandra dev

This is an awesome gadget in your toolbox, even if your test coverage is great. gem install ruby-debug (Ruby...

Our gem Mail Magnet allows you to override e-mail recipients in ActionMailer so all mails go to a given...

There will probably be better solutions as we become more experienced with using Bundler, and more command line tools become...

Rails 3, 4, 5, 6 config/application.rb config/environment.rb before the initialize! call (we don't usually edit this file)