Archive for the 'Rails' Category

Mar21

Back on track

Well, it’s been nearly a year, but I’m finally riding the Rails again.  I’ve dusted off my old app that I was working on a year ago and in the past few days I’ve added some features to it.  The main thing I’ve been working on is support for uploading multiple images to a single […]

Continue Reading »

Filed in: Rails

Jul2

Update on some things

It’s obviously been a while since I’ve posted, so I wanted to provide an updated. I’ve been inured with too many things that have distracted me from my Rails project for a time, though I hope to return to it soon as I hope it will be profitable for me in more ways than […]

Continue Reading »

Filed in: Candor Code Rails Grails


Apr6

Rails Tip: Primary Keys

Rails by default uses a system-generated primary key called “id” for all persisted objects. I personally like this (for the very reasons Dave Thomas outlines in the Rails book on pp. 286-287), but if you don’t, you can change it. Like Dave, I don’t recommend it, but here’s how if you must.
class Friend […]

Continue Reading »

Filed in: Candor Rails

Apr6

Rails Tip: Overriding Defaults in ActiveRecord

Have you ever wish you could tell Rails the name of the table that mapped to your model class?  Perhaps you want a model to represent a legacy table (which could be any table that already exists which is either too painful to recreate or over which you have no control).  Or perhaps you just […]

Continue Reading »

Filed in: Code Rails


Apr6

Rails Tip: Using ActiveRecord Outside Rails

I have found as I’ve been working on my project that Rails has many very useful little features that may not be used all that often but are sometimes needed. As I come across them I hope to note them here in the hopes that they will help someone (myself included) at some point.
Yesterday […]

Continue Reading »

Filed in: Rails

Mar24

There’s a reason it’s called Paginating Find

I got tired of seeing the deprecation warnings about the old Rails pagination helpers, so I decided to seek out a better approach, but of course I wasn’t going to implement it myself.  With all of the skilled Rails pros out there, I had every intent of leveraging someone’s else’s success.
I succeeded, thanks to Ilya […]

Continue Reading »

Filed in: Code Rails


Mar24

Asserting a Rails controller response doesn’t contain certain content

I need to be able to assert that a response from a Rails controller doesn’t contain certain content, for example when the same action will respond to both GET and POST methods.  In my case I’m writing a register method in a LoginController and I want it to render the same view, but if the […]

Continue Reading »

Filed in: Code Rails

Mar23

Fixing broken functional tests on Rails scaffolding

I recently resumed work on a Rails project I started a few months ago only to find that some of the functional tests that Rails generated for some scaffolding code were failing. These tests were failing on a fresh checkout from Subversion, so it was obvious that I’d neglected to run the functional tests […]

Continue Reading »

Filed in: Code Rails


Nov21

Installing Rails with MySQL on a Mac

I recently ran into a problem with Ruby on Rails on my Mac when trying to execute the following command in a new Rails project.
rake db:migrate
The error I received was as follows.
dyld: NSLinkModule() error
dyld: Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib
Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle
Reason: image not found
Trace/BPT trap
A quick Google search turned up a blog post by Peter Morris […]

Continue Reading »

Filed in: Rails Mac



 

Popular Categories

Grails Mac Rails Bible Code Coffee Candor

About

I’m a software engineer by day and even busier by night.  This blog contains my thoughts on subjects from the Bible to lines of code.  I write (and drink) Java, I’m learning Ruby and Rails and I read the King James Bible.  I’m hoping to move the country and buy a farm and stay home with my family to bring them up in the nurture and admonition of the Lord.