ozmm.org

require 'net/http' module Cheat extend self # the magic ingredient def host @host ||= 'http://cheat.errtheblog.com/' end def http @http ||= Net...

makandra dev
github.com

edge_rider is Power tools for ActiveRecord relations (scopes). Please note that some of the functions edge_rider provides have...

As you know, assignable_values does not invalidate a record even when an attribute value becomes unassignable. See this example...

makandra dev
github.com

EdgeRider 0.3.0 adds support for Rails 4.1 and Ruby 2.1. It forward-ports ActiveRecord::Base.scoped to Rails 4.1.

github.com

jQuery plugin that makes it easy to dynamically add and remove records when using ActiveRecord's nested attributes.

ActiveRecord caches results of SQL queries. If you want to discard the cached results for one model, you can call...

Edge Rider gives your relations a method #origin_class that returns the class the relation is based on.

Programatically invoke Rails generators Require the generator, instantiate it and invoke it (because generators are Thor::Groups, you need...

github.com

Now you can say: class Song < ActiveRecord::Base attr_accessor :virtual_attribute assignable_values_for :virtual_attribute do

By default, Rails' validates_uniqueness_of does not consider "username" and "USERNAME" to be a collision. If you use MySQL...

Put the attached file to config/initalizers to ignore some fields for rejecting nested records (e.g. hidden input fields).

When you use a belongs_to or has_many macro you might be surprised that the methods that it generates...

Store each models version in a separate table class Post < ActiveRecord::Base has_paper_trail :class_name => 'PostVersion' end

Wondering how a specific method on an object is exactly named? You can use Enumerable#grep to detect it in...

robots.thoughtbot.com

Arel is a library that was introduced in Rails 3 for use in constructing SQL queries. Every time you pass...

makandra dev
robots.thoughtbot.com

Rails 4.0 introduced a helpful new method for ActiveRecord queries: where.not. It can make clunky queries easier to read.

makandra dev

We have released Modularity 2. It has many incompatible changes. See below for a script to migrate your applications automatically...

tl;dr: Using has_many associations with a :through option can lead to lost or duplicate records. You should avoid...

We've since created ActiveType which has a restricted subset of Virtus' features. It might be enough for your needs...

In Ruby, classes and modules are called constants. This card explains how Ruby resolves the meaning of a constant.

What Rails version Within before_* Within after_* Cancel later callbacks Rails 1-4 return false return false Cancel later callbacks...

This error occurs when you already have a database.yml which defines the database for the cucumber environment instead of test...

Say you have a User with a Carrierwave attribute #avatar: class User < ActiveRecord::Base mount_uploader :avatar, AvatarUploader end

stackoverflow.com

When you want to find out the data type of an attribute, you can just use ActiveRecord's columns_hash...