When the config.gem statement was introduced I was pleased. It was great to have a centralized list of what gems were required by your application and with the rake gems:install task it would, in some cases, install the gems defined. More about that later, in another post.
After some time issues started to surface [...]
Archive for the ‘RubyOnRails’ Category
config.gem
Posted in RubyOnRails on April 10, 2009 | Comments Off
Convention of Configuration
Posted in Process, RubyOnRails on March 6, 2009 | 4 Comments »
My company is currently working on multiple Rails sites simultaneously. This involves multiple development groups and an infrastructure team tasked with providing multiple environments (continuous integration, qa, staging and production) for each project. There are many elements required to make this happen and we are in the process of working through the kinks. [...]
Dynamic Content and Action Caching
Posted in RubyOnRails on October 3, 2008 | Comments Off
I recently deployed a Rails application that, for various reasons, required caching dynamic content. All dynamic content is represented by a core “Content” model that contains a url attribute. In order for my app to show these pages I have the following as my last route:
map.dynamic ‘:p1′,
:controller => “contents”,
[...]
Rails Routes
Posted in RubyOnRails on August 14, 2008 | 1 Comment »
I don’t frequently have the need to create anything more than the basic “map.resources :model” route. As things go, this means I don’t remember how to anything other than the basic routes and forget the difference between :collection and :member and how that translates to urls and helper methods. So, I’m creating this [...]
jQuery observe_field
Posted in RubyOnRails, jQuery on August 5, 2008 | Comments Off
I’ve never been much of a Javascript fan, but thanks to jQuery, I find myself actually enjoying the times when Javascript is needed. This is nothing against Prototype, the jQuery syntax just clicks with me.
As Rails is coupled with Prototype pretty well, I didn’t want to do a complete switch with something like JRails, [...]
ActiveRecord.maximum
Posted in RubyOnRails on July 30, 2008 | Comments Off
ActiveRecord has a nice little calculation helper method called maximum that can be used to find the maximum value for a column in the database. If you’ve added the ability to sort data, this comes in handy when you want to insert a new record at the end. However, if you are creating [...]
Generate Rails project for prior version
Posted in Quick Tips, RubyOnRails on July 14, 2008 | Comments Off
In the event you have multiple versions of the Rails gem and want to generate an older version, you can do the following:
rails _2.0.2_ myapp
This will create a new myapp directory with Rails version 2.0.2.
PaperClip and Rails 2.1
Posted in RubyOnRails on June 24, 2008 | Comments Off
These are a couple of quick tips for using PaperClip 2.1.2 and Rails 2.1. I don’t know if there is a difference with other version combinations.
For security reasons, you may want to store your attachment out of the public directory:
class DocumentVersion < ActiveRecord::Base
belongs_to :document
has_attached_file :version,
:path => [...]
Timestamped Migrations
Posted in RubyOnRails on June 17, 2008 | Comments Off
<update>As soon as I figure out how, I will be submitting a patch to Rails to make this an option. I would like to use something like:
config.active_record.timestamped_migrations = true
This was suggested in a comment by hardbap referencing the announcement of this post. I agree with idea, but think the default should be false [...]
Generators and Timestamped Migrations
Posted in RubyOnRails on June 2, 2008 | 1 Comment »
I’ve never liked the idea of timestamped migrations, still don’t. So, not to my surprise, this was the first (and only) thing that bit me when testing the Lockdown generators against the latest release of Rails (2.1).
What happened? Well, the Lockdown generator generates 5 migrations, and contrary to all the speed talk surrounding [...]
