Tag Archive: rails

Resolving issues with Namespaced Models in Rails 3.1.0

I recently was tasked with upgrading an application from Rails 2.3.8 to Rails 3. I choose to upgrade it to Rails 3.1, because why upgrade once and then have to do it again later. After upgrading and testing many points of the system locally, I was ready to push the upgraded application to the production…

Issues with RVM

I recently decided to check out BrowserCMS, to evaluate how it work and decide to use it…or RefineryCMS. I didn’t expect that BrowserCMS would require Ruby 1.9.2. I’ve been running with Ruby 1.8.6 or 1.8.7 for quite a while now without any issues. It looks like it was time that I install RVM: Ruby Version Manager….

Advanced Use of Will_Paginate

I’m building an index of contacts, displayed with paginated links provided by will_paginate. The wiki for this plugin advises you on how to do setup your controller method, and what to put in the view to obtain a simple set of links, such as: # /app/controllers/contact_controller.rb def index @contacts = Contact.paginate :page => params[:page], :per_page…

Getting File object for Paperclip Attachment via S3

I’m working on a project where we are using the Paperclip plugin for Ruby on Rails for file handling and associations with other models. I’m working on a CSV import option right now, using this tutorial to help me get a head start on how to break the contents of the file up into rows…

Annotate Models

There is a rails plugin which adds schema information for the models in comments at the top of your model definition files. It’s really useful. Check out the instructions on installing and using this plugin at: http://pragdave.pragprog.com/pragdave/2006/02/annotate_models.html

Setting up Deployment for Rails using Capistrano, Apache with Passenger and Git

I don’t have time right now to learn how to setup Capistrano. I just want a recipe that works and does the job. Here are my notes. 1) First install the Capistrano gem sudo gem install capistrano 2) Next you need to go into the directory of your Ruby on Rails application and capify it:…

Database Schema Information

It can be very useful to have the database table schema information available to you when you are working on a model in a Ruby on Rails application. There is a plugin available which provides the schema information in comments at the top of each model called Annotate Models Plugin. # == Schema Information #…