The SQL code generated by Graticule's spherical distance computation is insufficient and can lead to NULL distances in edge...

apidock.com

Using rename_column, remove_column, etc. more than once in a migration makes that migration run slower than it should...

When you have objects in your database that hold latitude and longitude and you want to find others that are...

Instead of running all missing migrations on your test database with rake db:migrate RAILS_ENV=test you can also...

You can use heredoc to avoid endlessly long lines of code that nobody can read. Heredoc strings preserve linebreaks and...

makandra dev

Here is a way to create a duplicate of one database, with all its tables and their data, under a...

While it might seem trivial to implement an invoice that sums up items and shows net, gross and vat totals...

When storing floating-point numbers such as prices or totals in an SQL database, always use a DECIMAL column. Never...

User.active.to_sql Rails 2 Use either the Edge Rider or fake_arel gem to get #to_sql backported...

There are times when you need to send SQL to the database, like this: def self.some_count(field) field = connection.quote...

Deadlocks only occur if two transactions in separate threads compete for the same rows in the database. They usually (but...

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

When you load a record with find options that have SQL fragments in :select or :joins, ActiveRecord will make that...

github.com

Ancestry is a gem/plugin that allows the records of a Ruby on Rails ActiveRecord model to be organised as a...

makandra dev

This may be awkward to set up, but will work once you're done. Fun facts:

makandra dev

tmp/* storage/* db/*.sqlite3 db/schema.rb db/structure.sql public/system .project .idea/ public/javascripts/all* public/stylesheets/all* public/stylesheets/*.css config/database.yml *~ *#* .#* .DS_Store webrat-*.html

lambie.org

I’m working on a problem for a client which involves connecting to a Microsoft SQL Server 2005 database from...

aub.github.com

Record Filter gives you the full power of ActiveRecord's query building tools with a heaping helping of DSL thrown...

Best results in other decks

DevOps Curriculum

Mit SQL spricht man mit relationalen Datenbanken. Ziele Verstehe die folgenden SQL Befehle SELECT WHERE ORDER INNER JOIN, LEFT JOIN...

When changing glibc versions, it's possible to end up with corrupt indexes in PostgreSQL. Are My Indexes Affected?

Search in all decks