Resolve Aspell errors with your Rails application

Posted Over 13 years ago by Arne Hartherz.

If you get an error message like that you are missing the Aspell files a specific language:

apotonick's hooks at master - GitHub

Posted Over 13 years ago by Lexy.
github.com

Hooks lets you define hooks declaratively in your ruby class. You can add callbacks to your hook, which will be...

Even with bundler your gem order can be significant

Posted Over 13 years ago by Henning Koch.

Even when you're using bundler, it might be significant in which order your gems are listed in your Gemfile...

An obscure kernel feature to get more info about dying processes

Posted Over 13 years ago by Lexy.
timetobleed.com

This post will describe how I stumbled upon a code path in the Linux kernel which allows external programs to...

Inline if-then-else in MySQL queries

Posted Over 13 years ago by Henning Koch.

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

Precedence of Ruby operators

Posted Over 13 years ago by Arne Hartherz.
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...

Generate a strong secret from the shell

Posted Over 13 years ago by Henning Koch.

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

jsmestad's pivotal-tracker at master - GitHub

Posted Over 13 years ago by Lexy.
github.com

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

Install the Paperclip gem on Ubuntu servers

Posted Over 13 years ago by Tobias Kraze.

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

Be careful with Array(...)

Posted Over 13 years ago by Tobias Kraze.

A popular ruby idiom I keep stumbling upon is def do_some_thing_for(values) values = Array(values) values.each { … }

Security issues with hash conditions in Rails 2 and Rails 3

Posted Over 13 years ago by Arne Hartherz.

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

How to collect a Hash from an Array

Posted Over 13 years ago by Henning Koch.

There are many different methods that allow mapping an Array to a Hash in Ruby. Enumerable#index_by (any Rails...

Cheating Rails: Calling render() outside your Controllers

Posted Over 13 years ago by Lexy.
axonflux.com

Do that for noble reasons only.

Get Your C On

Posted Over 13 years ago by Lexy.
robots.thoughtbot.com

Getting started with Ruby extensions in C.

Rename hash keys

Posted Over 13 years ago by Arne Hartherz.

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

clemens's delocalize at master - GitHub

Posted Over 13 years ago by Lexy.
github.com

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

Install RubyGems on Ubuntu/Debian

Posted Over 13 years ago by Arne Hartherz.

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

Detect the language of a string

Posted Over 13 years ago by Arne Hartherz.
github.com

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

Install a local Gemfile on a remote server

Posted Over 13 years ago by Tobias Kraze.

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

Know your Haml comments

Posted Over 13 years ago by Arne Hartherz.

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

Debug Ruby code

Posted Over 13 years ago by Henning Koch.

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

Load order of the environment

Posted Over 13 years ago by Henning Koch.

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

Bundler for Rails 2.3.x

Posted Over 13 years ago by Thomas Eisenbarth.

Update RubyGems and Passenger Bundler requires Rubygems >= 1.3.6. Run gem update --system if you have an older version.

Recursively remove unnecessary executable-flags

Posted Over 13 years ago by Arne Hartherz.

Sometimes files attain executable-flags that they do not need, e.g. when your Windows VM copies them over a Samba...