Posts Tagged ‘ activerecord ’

Double Shot #523

August 21, 2009
By Mike Gunderloy at A Fresh Cup
Double Shot #523

There’s early and then there’s insanely early.master_slave_adapter – Nice approach to doing master-slave databases in Active Record through a custom adapter that dispatches the database calls. Online Viewstate Viewer / Decoder for Asp.Net 2.0 – I didn’t think I’d need this sort of thing any more. I was wrong. looksee – Library to examine the method...
Read more »

Tags: , , ,
Posted in A Fresh Cup, Publishers | View Comments

ActiveRecord refererential integrity is broken. Let’s fix it!

August 18, 2009
By Jon at Rail Spikes - Home
ActiveRecord refererential integrity is broken. Let’s fix it!

ActiveRecord supports cascading deletes to preserve referential integrity:1 2 3class User has_many :posts, :dependent => :destroy endBut you really only want cascading deletes about half the time. The other half, you wa...
Read more »

Tags: ,
Posted in Publishers, Rail Spikes | View Comments

Using model constants for project sanity

June 22, 2009
By Robby Russell at Robby on Rails
Using model constants for project sanity

On one of our larger client projects (approx. 160 models and growing…) we have a specific model that we refer to quite a bit throughout our code. This model contains less than 10 records, but each of them sits on top of an insanely large and complex set of data. Each record refers to...
Read more »

Tags: , , , , , , ,
Posted in Publishers, Robby on Rails | View Comments

Today’s hard-won lesson

March 5, 2009
By Luke Francl at Rail Spikes - Home
Today’s hard-won lesson

An float subtracted from an integer results in a float. When typecast by ActiveRecord, this is converted to an integer.validates_numericality_of with :only_integer => true results in a rather obscure error message if a non-integer i...
Read more »

Tags: ,
Posted in Publishers, Rail Spikes | View Comments

[PLUGIN RELEASE] ActsAsOverflowable

July 9, 2008
By John Constable at
[PLUGIN RELEASE] ActsAsOverflowable

acts_as_overflowableWritten by Nicholas Lega== DESCRIPTION:Allows a column to overflow data into a secondary column if the data size exceeds the character limit. This is useful for fast indexing.Instead of trying to index text blobs, you can specify a varchar column to be used for indexing. Any characters that do not fit into the...
Read more »

Tags: , , , ,
Posted in Publishers, Revolution On Rails | View Comments

[PLUGIN RELEASE] ActsAsSeoFriendly

June 19, 2008
By Jeffrey at
[PLUGIN RELEASE] ActsAsSeoFriendly

ActsAsSeoFriendly== DESCRIPTION:Create an SEO friendly field for a model automatically based on a given field.So if you have a Blogs model, and you would like create an SEO friendly versionof the 'title' field, you would just add this to your model and then be able touse the SEO friendly id as the unique id...
Read more »

Tags: , , , ,
Posted in Publishers, Revolution On Rails | View Comments

Acts As Fast But Very Inaccurate Counter

May 25, 2007
By Val Aleksenko at
Acts As Fast But Very Inaccurate Counter

IntroductionIf you have chosen the InnoDB MySQL engine over MyISAM for its support of transactions, foreign keys and other niceties, you might be aware of its limitations, like much slower count(*). Our DBAs are in a constant lookout for slow queries in production and the ways to keep DBs happy so they recommended that...
Read more »

Tags: , , ,
Posted in Publishers, Revolution On Rails | View Comments

Plugin I Cannot Live Without

May 11, 2007
By Val Aleksenko at
Plugin I Cannot Live Without

The Enhanced Rails Migrations plugin was written to end the constant battle we had with clashing names in db migrations within our large development team. We tried everything: special commit policies, rake tasks, even claiming the next migration number in subversion. Nothing worked and CI server was sending 'broken build due to conflicting migration...
Read more »

Tags: , , , , ,
Posted in Publishers, Revolution On Rails | View Comments

Moving models to a different database

May 9, 2007
By Val Aleksenko at
Moving models to a different database

There many reasons to use multiple databases (DBs) and when this is done, there is often a case when a model needs to be moved from one DB to another. The impetus could be that part of the data is referential and this is being reflected by moving it to a read-only DB. Another...
Read more »

Tags: , , , , ,
Posted in Publishers, Revolution On Rails | View Comments

DRYing Models via Acts As

May 7, 2007
By Val Aleksenko at
DRYing Models via Acts As

ActsAs is an idiom familiar to every Rails developer, which makes it a good candidate for a shared functionality between models. Using it as early in the game as possible allows one to work on its functionality without a need to touch the code in multiple models. Let's look at a couple of examples.Acts...
Read more »

Tags: , , , ,
Posted in Publishers, Revolution On Rails | View Comments