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 »
Posts Tagged ‘ activerecord ’
Double Shot #523
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 »
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 »
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 »
[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 »
[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 »
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 »
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 »
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 »
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 »