Category Archives: ruby

Embracing Conventions With Namespaced Models And Partials

Six months ago when I started working a contract with Joey Beninghove, I had never done full time rails work. I had played with it a few times and built a few small example apps just to get the hang … Continue reading 

| Comments Off

Keep Your Demo Data Separate From Your Seed Data

File this under the “duh…” category… I don’t know why this wasn’t obvious. Joey and I have been working on our rather large app for a while now, with a bunch of demo accounts and data added with our seed … Continue reading 

| Comments Off

Converting A Range And A Value Into A Scaled Value, With A Nice Background Color

I’m working on a web app that receives HL7 formatted medical data through my import utility that I’ve talked about a lot, recently. Once I receive those results, I have to parse them out of the file and then display … Continue reading 

| Comments Off

Deploying A Thor Application With Vlad, From Github, Run As A Cron Job

The previous 4 blog posts, in combination with a few others, have basically been a series of posts all leading up to this one. If you read them all in the right order (and possibly a few of the links … Continue reading 

| Comments Off

Using Mongo And Mongoid Without Rails

In my previous post on writing a thor application, I mentioned the use of mongo db and the mongoid document mapper, and how I am using these tools outside the context of a rails application. As I mentioned in that … Continue reading 

| Comments Off

Writing A Thor Application

I’ve talked about what I went through to learn thor, already. After all of that, I found myself becoming rather fond of thor and the end result of learning thor was a nice little command line tool that I am … Continue reading 

| Comments Off

The Whenever Gem: Making Cron Easy

I recently had to learn how to use Cron to set up a scheduled task on our rails server. In spite of the ubiquity of cron, I found the documentation and even the “how to” tutorials to be horrible at … Continue reading 

| Comments Off

Replacing An If Statement With An Object

I found myself writing this code yesterday: def to_s if status == AssessmentStatus::Open date = get_assessment_short_date(:date_opened) “#{assessment.name}, Opened #{date}” else date = get_assessment_short_date(:date_closed) “#{assessment.name}, Closed #{date}” end end   I wrote it and moved on. It worked and it did … Continue reading 

| Comments Off

Getting Started With Thor

I’ve known about Thor for some time now, and have been using it in my Rails 3 work. It seemed like a great little tool for writing command line apps in ruby. So, when I had a need to write … Continue reading 

| Comments Off

Case Insensitive Dir.glob In Ruby: Really? It Has To Be That Cryptic?

I’m writing a small file importer in Ruby 1.9, to grab files form an FTP drop. The files are HL7 format, and will have a .HL7 extension. However, I had no guarantee that it would be capitalized .HL7 for the … Continue reading 

| 5 Comments