MetaSkills.net
Coding things under other things!

Ruby/Rails

Pretty Console Logging With Guard::Jasmine & Black Coffee

OK I know I promised that we would start the dive into testing your Spine.JS application using Jasmine(rice) in my last article, but this is a good diversion. If you are new to my latest series on Spine.JS and Jasmine, scroll on down to the bottom to the related section and read back. However, for those that might be more familiar with Jasmine and specifically Guard::Jasmine and ever felt the pain that debugging from that terminal window was lacking, read...

Rails & Spine.JS - Jasmine Testing Part 2

So this is the third part to my mini series on Rails and Spine.JS. Part one covers an initial setup and how to include Spine.JS into your Rails project while part two is actually the first of a tome on how to test your Spine.JS application. Assuming you have covered the bases there, lets get right down to business and review some of the elegant hacks ™ yours truly came up with while testing my own Spine.jS application using Guard...

Rails & Spine.JS - Jasmine Testing Part 1

In my previous article I talked a little bit about why I decided to use Spine.JS and how to include the CoffeeScript source into your Rails project using git submodules. Now I would like to talk about testing your brand new Spine.JS application. Afterward, be sure to read the second part to this article which covers more advanced aspects of your Spine.JS application specs. Testing JavaScript OK, so like any good programmer, you want to test your JavaScript web application,...

Rails & Spine.JS - Using The CoffeeScript Source

Our options for JavaScript MVC frameworks are numerous these days. While working on the third major rewrite of my personal bookmarking application, HomeMarks, I decided to learn Backbone.js. Thankfully a local friend of mine recommended that I try Spine.JS. I was immediately hooked! Why Spine.JS? Spine.JS is is authored in CoffeeScript and that is a big deal for me. I will never write raw JavaScript again, which I consider, the deprecated syntax. So a JavaScript MVC framework that is written...

LESS Is More - Using Twitter's Bootstrap In The Rails 3.1 Asset Pipeline

This weekend I decided to experiment with LESS CSS by replacing the existing Sass and Compass code that had been built thus far a small project. Why? Three basic reasons. First, I wanted to see how LESS stacked up. Second, I was intrigued by some of LESS' features, in particular their namespace support. Lastly, I wanted to use Twitter's Bootstrap project as a baseline for my design. Since Rails 3.1 has been out for some time, I was expecting the...

jQuery Mobile & Rails

I just finished my first dive into using jQuery Mobile with a Rails application and wanted to share some techniques that came out along the way. Hopefully these will help you if your are using jQuery Mobile with Rails or want to test your mobile application's integration layer. This post assumes you are somewhat familiar with jQuery Mobile and its basic concepts. So let's jump right in with a series of helpful tips. A Mobile Layout In my application, I...

Use Compass Sass Framework Files With The Rails 3.1.0.rc5 Asset Pipeline

UPDATE: Now that Rails 3.1 is out, just use the latest compass or pre-release. No hacks needed! This is a simple update to my original article for using compass's .scss files with the asset pipeline. This assumes you had this setup working in Rails 3.1.0.rc4, but should be helpful to anybody. The good news is that most everything is wired up. First, you are going to need to update your Gemfile. Follow the latest conventions and make sure you have...

Free The Enterprise With Ruby & Master Your Own Domain

For anyone that did not attend the first MADExpo (Mid-Atlantic Developer Expo) this week, here are my slides posted on slideshare. This talk centers around 3 basic sections. The first is general Open Source and what it can do for you as a software developer to increase your skills and general knowledge. Second, it covers some key open source projects I have been working on. Specifically for SQL Server and and ActiveRecord which includes projects like TinyTDS and the latest...

The Browser Is Dead?

This twitter post by Dave Thomas sparked an interesting back and forth with DHH on how Rails 3.1 could be more opinionated towards web development for the browser. A short time before – it was announced that Rails would include CoffeeScript and Sass as defaults for JavaScript and CSS authoring. FWIW, both of these new defaults are in my opinion the best of the breed fore each task. If you have not done so, I suggest taking a quick read...

Use Compass Sass Framework Files With The Rails 3.1 Asset Pipeline

UPDATE: Now that Rails 3.1 is out, just use the latest compass or pre-release. No hacks needed! The Sprockets 2 gem along with the Tilt gem make it really easy to write JavaScript or CSS using any templating language you desire. The rails defaults are CoffeeScript and Sass. About the best collection of Sass framework files for easy cross-browser CSS authoring are packaged in the compass framework. Compass even has great documentation for using their Sass framework. But what if...

Speaking At MADExpo

Over the past few months I have been actively working with both Luis Lavena and Wayne E Seguin to incorporate both TinyTDS and the SQL Server Adapter into the latest release of the Rails Installer for Windows. Like them, I firmly believe that Ruby's success is tightly bound to how well we can bring these tools to the Windows platform. So despite that I have no love for the Windows – I do want to see Ruby succeed and help...

Using MiniTest::Spec With Rails

So after a few blog post on the subject of MiniTest::Spec, I finally have a simple testing stack for Rails 3 that leverages MiniTest's spec DSL. I introduce to you the MiniSpecUnit gem. MiniSpecUnit defines a Test::Unit::TestCase class that subclasses MiniTest::Spec. It implements only what is needed to make rails happy. It is not a drop in replacement for the real Test::Unit::TestCase that is included with ruby 1.9. Once you bundle the gem in your Rails application, it will satisfy...

MiniBacktrace - For MiniTest & Rails

UPDATE: Using MiniTest::Spec With Rails & From Test::Unit & Shoulda To MiniTest::Spec & MiniShoulda MiniBacktrace allows you to take advantage of the Rails.backtrace_cleaner when using MiniTest. This includes everyone using Rails 3 with Ruby 1.9. Just add 'mini_backtrace' to your Gemfile's :test group and your should automatically see a huge difference. Any additions to the Rails.backtrace_cleaner should now work. Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }

PDFKit Overview & Advanced Usage

Last week I had the pleasure of rewriting 4 years of legacy PDF::Writer code to PDFKit. Why? Well drawing pdfs in ruby using libraries like PDF::Writer is like composing a webpage with an Etch A Sketch. In short, its a damn chore that involves a bunch of code that mixes both data and presentation. Sure there are gems like Prawn that make this much easier, but nothing beats drawing your pdf code in native HTML and CSS, and that is...

GC Tune Ruby 1.9.2 With RVM

Here is a gist by Sokolov Yura (funny-falcon) that allows you to GC tune Ruby 1.9.2 just like Ruby Enterprise Edition (REE). So all of us using RVM have no reason not start using this right away. Here are the steps. $ curl https://gist.github.com/raw/856296/patch-1.9.2-gc.patch > ~/192-gc.patch $ rvm uninstall 1.9.2 $ rvm install 1.9.2 --patch ~/192-gc.patch I have used this RVM hook below for awhile now. It automatically sets and unsets the proper ENV vars to GC tunes my REE....

Modern SQL Server & Ruby/Rails Installer For Windows

If you have not done so, please go read my article Modern SQL Server & Rails on the Engine Yard blog. I want to thank Wayne E Seguin for inviting me to write the article. This article details many exciting things that have been happening for those using the SQL Server Adapter for Rails, most notably TinyTDS. The article outlines why everyone still using the ODBC connection mode should really switch over to TinyTDS. Many exciting things are happening thanks...

Simple Memcached Reports In Rails

The Pragmatic Bookshelf's Using memcached: How to scale your website easily is way old. But then again, memcached is still very useful. One of the things I remember reading a long time ago was the stats for your process and how to pull out meaningful reports like a hit ratio, memory and a get to set ration. I whipped these up today as a simple way of getting a report using Rails.cache.report, assuming your cache strategy is set to memcached....

From Test::Unit & Shoulda To MiniTest::Spec & MiniShoulda

UPDATE: Using MiniTest::Spec With Rails & MiniBacktrace For MiniTest & Rails It seems the MiniTest replacement for Test::Unit in Ruby 1.9 has been presenting itself more and more in my daily readings. Recently was Jamis Buck's article titled The road to faster tests where he talks about optimizing basecamp's suite to run faster. And there again, some of the comments below mentioned MiniTest as a solution. That got me thinking on what would it take for me to switch from...

Automating Heroku PG Backups

On December 1st, Heroku deprecated their bundles add-on in favor of their new PG Backups. Even though there are other solutions for automating backups using this new add-on, none of them met my needs. I like to have a daily DB backup history, just in case you find something bad that happened "n" days earlier. Below is a simple rake task suitable to place in your rails lib/tasks/heroku.task file. I'll explain some things I learned below when writing this. require...

Let It Go - Moving From Mephisto To Jekyll

Welcome to the new MetaSkills.net! I have moved from Mephisto to Jekyll and done a complete rewrite of the presentation layer to the latest web standards as a way of staying somewhat sharp with the latest HTML5/CSS3 hotness. In this article, I would like to cover all the gory details of what I learned about moving to Jekyll and the various techniques I have used for the site's CSS. But first a small history lesson. If you are somewhat new...

TinyTds - A modern, simple and fast FreeTDS library for Ruby using DB-Library

I just finished the first cut of learning C extensions for ruby and I present The TinyTds gem. It is meant to serve the extremely common use-case of connecting, querying and iterating over results to Microsoft SQL Server databases from ruby. Even though it uses FreeTDS's DB-Library, it is NOT meant to serve as direct 1:1 mapping of that complex C API The benefits are speed, automatic casting to ruby primitives, and proper encoding support. It converts all SQL Server...

How To Clean A Campfire Room Of Uploads

For us at work, our uploads to campfire are really transitory. Most of the time they are simple screenshots around a current topic. Every now and then vacation photos or even movies, at the end of the day, none of it has value after a certain amount of time. To us as the real value of campfire is our textual transcripts. This morning after 4 years of campfire, we were real close to our 1GB limit of uploads. Time for...

The RVM Ruby API - Setting Up A CI System For The SQL Server Adapter

A few weeks ago I started looking into the Ruby Version Manager (RVM) project to help me build a better testing setup for both my day job and the ActiveRecord SQL Server Adapter. In a previous article I covered details of how to get a development stack up and running for Rails with SQL Server using MacPort's. This article will cover some new additions to that goal, but first and primarily, I wanted to talk about the wonders of RVM...

A MacPort/RubyODBC Update

TinyTDS is the upcoming de facto raw connection method for the SQL Server adapter. Please read the Using TinyTDS wiki page on the adapter for switching. No longer do you have to worry about compiling ODBC layers! I have changed my mind about the UTF-8 version of RubyODBC. Please read that section in the the rails 3 announcements for the SQL Server adapter. Quite a while ago I wrote a soup to nuts article on getting the full multi-ruby development...

Bit Fat Legacy Schema Inspection

Sometime in rails 2.x the #inspect method for an ActiveRecord class was changed to show you all the column names (attributes) of that class. This is fine when things are small but if your working on a big legacy schema and you want clean terse debugging, all those column names can be noisy. I just set this initializer up today to kill it. Now the class just shows the number of columns. module ActiveRecord class Base class << self def...

Custom Webrat::Session formatted_error For Rails With Nokogiri

I never liked how Webrat shows the complete response body for exceptions when integration testing rails applications. For the longest time I redefined the formatted_error method to simple do nothing. Today I used Nokogiri to parse out the good bits from that page. Here is the result. Not pretty, but it's working fine so far. Got a better example? Please share! module Webrat class Session def formatted_error doc = Nokogiri::HTML(response_body) exception_name = doc.css('head title').inner_html.squish exception_msg = doc.css('body h1').inner_html.squish exception_detail1 =...

The alias_method_chain of Rake - Override Rake Task

Rake is cool. It is built so that multiple tasks with the same name run in a reverse defined series. This is great, but sometimes you want to override a task with your own behavior and conditionally call the earlier task. Especially if that task is defined deep somewhere else, like in a rails gem. I have had to solve this problem before in Rake. Awhile back I hacked something up that would totally trump a predefined rake task and...

RESTful AJAX with Forgery Protection (In Rails 3)

A while back ago I wrote an article about how to use Rails built-in forgery protection in your RESTful AJAX calls. Normally AJAX requests, those responding true to request.xhr? in rails, are forgery whitelisted. But sometimes, and under what conditions I am not sure, AJAX methods are subjected to forgery protection. Maybe you have the ActionDispatch::Request#forgery_whitelisted? overridden to not include AJAX requests? Either way and for whatever reason – if you like to use forgery protection in your RESTful AJAX...

Simple Script/Console Function

This is something simple I worked up today for my ZSH profile that let's me keep my simple sc alias and have it work with all versions of rails. If you did not know, all the script files in rails 3 are gone and the new all-in-one rails executable does all the heavy lifting. This little function even passes down all the arguments too. sc () { if [ -f ./script/rails ]; then rails console $argv else ./script/console $argv fi...

Unobtrusive JS In Rails 3 With Prototype

An updated version of UJS and forgery protection in Rails3 here. Are you bleeding on the edge of rails 3 and need to shim up some unobtrusive JavaScript to work with your link_to code that uses a destructive :method option? I did today and here is what I did to solve it. If you are unfamiliar with the problem, and what has been happening in rails 3 with UJS, check out Piotr Solnica's blog for a good run down. Or...

Rails Button Links In Embedded Forms

This is one I have had sitting around for almost 3 years now in my toolbox and thought I would share. Have you ever had complicated rails forms and needed simple form buttons that just took you to a simple link? Were you bitten by the button_to helper code because it generates another form inside of a form? If so, here is a simple rails view helper I made that creates simple button links for embedded forms by making an...

Authenticated S3 GETs For Private Objects Using Paperclip

UPDATE: [10/18/2011] I now use Fog vs AWS::S3 with Paperclip. I have included a Fog specific example below. Yea I know, I am probably the last person on earth that is just getting around to using Paperclip. To be honest, most of my file upload code was written way before Paperclip or even AttachementFu was ever conceived. And frankly, I do not do much social app coding on the side - so the need never came up. But that changed...

Meta Programming In...

Last nights 757.rb meeting was a great success. We did a talk titled Introduction To Ruby & Rails for all the new comers that might have been interested in learning more about both - from the ground up. Since Ruby was my first language and my toolbelt only extends to JavaScript and Objective-C, I'm always interested in how other languages do the things that I love so much in Ruby. One of the biggest pluses for Ruby, to me, is...

Installing REE With The Snow Leopard SQL Server Stack

Today I noticed that Ruby Enterprise Edition 2009.10 was released and I have really been wanting to see if I could get the SQL Server adapter tested and running under it. I am really curious how the speed improvements might look and will share my results below. This article assumes that you read my previous guide titled The Ultimate OS X Snow Leopard Stack For Rails Development - x86_64, MacPorts, Ruby 1.8/1.9, SQL Server, SQLite3, MySQL & More as I...

The Zombie Shotgun Revisited

My how time flies. Over a year ago I created a simple bit of code that was useful for stopping ActionController routing errors from common Microsoft attacks from sending exception notification emails. Well now most people do not use exception notifications emails in favor of apps like Hoptoad. And hey, most code like this has moved to Rack middlewares. Yesterday I noticed a rack code competition that encouraged "most useful and top quality Rack middlewares". Well the Zombie Shotgun is...

757 Studio

Well it took up quite a bit of my free time and a good 2 weeks of no iPhone development, but I am very very happy that the organization of my first event has been a success so far. Check out 757studio.org for full details. Andy Hunt is headlining the event with a talk on Pragmatic Thinking and Learning. Clinton Nixon and Jamie Pinkham will be following with talks on Ruby/Rails and iPhone/Cocoa. So even though I can not make...

The Ultimate OS X Snow Leopard Stack For Rails Development - x86_64, MacPorts, Ruby 1.8/1.9, SQL Server, SQLite3, MySQL & More

If you are interested in using RVM with a MacPort base for the SQL Server stack, check out this article. TinyTDS is the upcoming de facto raw connection method for the SQL Server adapter. Please read the Using TinyTDS wiki page on the adapter for switching. No longer do you have to worry about compiling ODBC layers! I have written an updated article on the MacPorts installation of the latest RubyODBC. It includes information pertaining to utf8 support. This guide...

757rb Memcached Talk

Earlier this week I gave a talk at our local ruby users group, 757.rb, about Memcached. Here recently I started picking it up again so that I could keep track of large sets of PK/FK changes during a big database move. In doing so, I decided to dig deep into it's internals and get a better grasp of how I would use it when I decided to do some serious fragment caching again. The biggest thing I took away from...

PDF::Writer For Ruby 1.9

If you have legacy code written for ruby 1.8 and you want to run 1.9 and support your old PDF::Writer code, then just jump right over to my Github pdf-writer fork and get it. $ gem install metaskills-pdf-writer If you are interested in knowing some of the dirty details about what pitfalls are under 1.9, read on. The biggest thing for me was getting used to the character encodings. Including string literals in your code that are say UTF-8 or...

Git & Subversion User Commit Reports

Want a list of the users and the number of commits they made? Git makes it really really easy, while I could not find such an easy method on Subversion. Here they are. Git $ git log | git shortlog -n -s Subversion #!/usr/bin/env ruby require 'rubygems' require 'activesupport' log_xml = `svn log -q --xml` svn_logs = XmlSimple.xml_in(log_xml)['logentry'] report_hash = svn_logs.inject({}) do |report,log| author = log['author'][0] report[author] ||= {:commit_count => 0} report[author][:commit_count] += 1 report end commits_authors = report_hash.keys.map {...

MultiRuby The MacPorts Way. Testing Your Rails Apps With Ruby 1.9

UPDATE: In a recent article, I covered how to install REE and have hence NOOP'ed this function to ignore the symlinking when REE is installed. Ruby 1.9.1, the stable release, is just around the corner and if your like me, maybe you want to start playing around with it and perhaps test a few projects using 1.9 with edge rails 2.3. If so, and your on a Mac, then perhaps this installation method might appeal to you. I'll break this...

Autotestify Brothers and Sisters

Based on my previous article Using Autotest For Rails Plugin Development, Brennan Dunn wrote a ZSH function that helps him with his eager rails plugin work. Testing plugins is simply the most fun you will ever have. It's nice to test in isolation and easy to make a plugin test multiple rails versions, etc. Typically plugin testing is very fast to because you are not burdened with excessive tests in a big app that might use it. Just the ones...

Go Buy Envycasts Now!

I got a chance to meet Gregg Pollack at this years RubyConf, a great guy. In fact I seem to owe him alot. Not only did I get 3 mentions lately on the main rubyonrails.org site, but it appears I got one of my 2.2 additions mentioned in their new envycast that covers rails 2.2. Sweet! So now it is my duty to help the Rails Envy guys to bank it Grossenbach-style. If you have not done so, go check...

SQL Server Adapter For Rails 2.2

So that about sums up what I've been doing for the past 4 weeks. A total rewrite of the SQL Server Adapter for Rails. On top of passing all the Rails 2.2.2 tests, which is MAJOR news, it includes tons of new features. Unicode column support, pessimistic locking, date/time column casting, DDL transactions and way more. On top of that. It was nice being mentioned on the rubyonrails.org website not for my first, second, but a THIRD time. Thanks Gregg!...

Code-O-Lanterns: What Scares You?

While reading the The Unofficial Apple Weblog today I noticed this sweet little Jack-O-Lantern screensaver for OS X. After some feedback on the 757.rb group, I decided to make some Code-O-Lanterns. Follow the instructions for the Jack-O-Lantern screensaver on where to put the carving files. If you are not on a Mac, I have taken some screen shots that you can use for desktop pictures. If you would like to see a code o lantern that is not up... just...

Plug It In Plug It In

I've been busy putting together some plugins form misc work. If you did not catch my latest article Jack has_many :things where I covered GroupeScope, by all means check it out. I've also just finished up a pretty solid backport of NamedScope that can be found on my Github page. It bills itself as a well tested complete back port for rails 1.2.6 and 2.0.4. One thing that has been a real help while I've been developing these plugins is...

Jack has_many :things

UPDATE: [12/06/2011] The GroupedScope gem has been updated for Rails 3.1. Many new features have been added with a few mentioned below. Check the project's readme for complete details. I am Jack's sofa, stereo and wardrobe... I make Jack's life complete. I reside in a ActiveRecord table called "things" and Jack is the only one that has the key. This is Jack's life, and it's ending one minute at a time. As rails developers, we have done this simple relationship...

Using Autotest For Rails Plugin Development

I love autotest. I have event posted before how to extend the idea of autotest sounds to a red/green playlist but now that I am taking more time to extract some of my work to plugins, I really wanted autotest to come with me. The problem is that the default autotest mappings do not play with rails conventions, the biggest being that test files for a lib match the name of the lib with _test.rb at the END of the...

Hell'OO HomeMarks

Well HomeMarks v2.0 is done and ready for the public. You can download it from my Github project page. It has a real simple rake app:bootstrap task that I came up with over the weekend will have you running a local copy in only a few seconds, give it a try. Sometime over the next few days, I'll move over the live site to this code base too. If you have not yet kept up on the implementation mantra I...

Stop Exception Notifications With The ZombieShotgun

I am all about knowing how to survive a zombie invasion – as much as I am a firm believer of using the right tool for a given job. It can not be argued that killing zombies with a shotgun to the head is as natural a fit as peanut butter to chocolate. They simply just go together. Now real zombies may not be a daily nuisance, but computer zombies are a daily pain in the butt to network administrators...

RESTful AJAX with Forgery Protection

Writing the new HomeMarks has been a great exercise. I've learned that the AJAX Head Design Pattern Implementation is more akin to developing a service-oriented application (SOA) since I have moved all client-side coupling from the controllers, like RJS, and only respond with HEAD or JSON data. Today I learned about Halcyon which is self described as a JSON web application framework built on Rack. If you take a look at their example, it looks a lot like HomeMarks v2,...

Coulda Shoulda Woulda

It has been about 6 months now since I started using the Shoulda testing plugin as my BDD/TDD tool of choice. Unlike a lot of other people, I did not flock to the RSpec bandwaggon. Personally I think RSpec is horribly bloated a sledgehammer for a simple issue, the need to have test code organized with nested setups and context blocks. If you are new to Shoulda, I highly urge you to take a look at the Thoughbot project page...

The "AJAX Head" Design Pattern

Chris Williams did a really great write up on this pattern with great details on when/how to use it. Please considering reading it afterward. This is the first of a few articles covering the total rewrite of the HomeMarks.com code base as I upgrade it to Rails 2.1. The "AJAX Head" pattern is the moniker I have assigned to methodology that has come about during said rewrite and the design decisions I choose early on. The rules were simple. Total...

Using RubyAMP TextMate Bundle With /opt Ruby

I've been a TextMate user for a long time now and I'm still finding new things to do with it. Here recently I wanted to use the RubyAMP TextMate Bundle and was a little miffed to find that it was pointing to my OS X system ruby. The error message looked something like this when it went looking for my ruby/gems. No such file to load -- appscript (LoadError) from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’ /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require’ ... My problem is that I...

How to use Passenger (mod_rails) with rails edge 2.1

UPDATE: This issue has now been resolved in the official release. If you are like me and have been using passenger, then you may have run into an issue when working with rails edge. I mean the REAL rails edge on Git, not that fancy rake task which I think is still pointing to a subversion snapshot. Let me take an aside on how to freeze rails edge to a project that you are managing in Git. This method is...

Now on Passenger (mod_rails)

Well this is working out well so far. I'm really liking the Passenger (mod_rails for Apache) extension. Right now I have this Mephisto site running it and it seems to be doing really well. Also, most people do not do this, but I run a full development stack Apache/MongrelCluster to mimic production boxes the best way I can. Now I am running mod_rails on all my development hosts. Some Things I Like I do not have to fuss with OS...

Autotest Playlist For Red/Green Feedback

Here is how to get a playlist of sounds that will be hooked to both your autotest :red and :green callbacks. Basically this gives you a folder of sounds that are played one after another, in a loop, as your tests pass or fail. See this move below for a quick example. Step 1: Install QTPlay from MacPorts $ sudo port install qtplay Step 2: Download My Autotest Playlist Files $ cd ~ $ curl -O http://cdn.metaskills.net/downloads/autotest_playlist.tar $ tar -xf...

Autotest Infinite Loop On Failure & Error

I just had an issue pop up today that seemed to be an issue for a few others. It seemed that all of a sudden that my autotest was stuck in an infinite loop after a failure or error. At first I thought it was related to some additions to my ~/.autotest file but after commenting out the whole lot of additions there, I realized it was something else. Here was my fix. Basically I think these errors are always...

How To Stop Delivery Of An Email Within An ActionMailer Method

OK, so you want to keep your code placement REALLY organized. You have read about my persnicketyness and now you want to practice the best in concern placement and keep those controllers of yours really slim. Like me, you may want to try and keep controller feature additions to very specific one liners of code. Organizing your controller code to do just that with ActiveRecord models or even your own custom classes is a pretty easy task, but how do...

Don't Be A Plinko Programmer

One of the things that I have really grown persnickety about is the placement of code. For example, I am a huge advocate that controllers in a rails project should read like a mini Domain Specific Language (DSL) and that as much logic as possible be delegated to the models. In my opinion the best way to do that in a Rails project is to learn the proper usage of ActiveRecord Association Extensions. You can check out the Rails API...

MetaSkills.net Reborn on Mephisto

Well after a year of neglect, the MetaSkills.net blog has been reborn on Mephisto. Previously I was using Drupal and it finally got to a point where I was so deep into ruby that I did not even have the gumption to open up a PHP session to publish anything. The sad part is that I told myself that this PHP disdain would help me get off my butt and move to Mephisto. You know, eat my own dog food...

Rake task to read and write the ActiveRecord schema version table.

After attending Rails Edge in Reston, Virginia I decided to move some common tasks from my ~/.irbrc file and put them into Rake. I thought I would share a task that reads and writes the ActiveRecord schema table. Sometimes in migrations this is either good to know or manually change. Simply copy this in a foo.task file in your project/lib/tasks directory and use rake -T to see the description and usage. I have placed these tasks in the db:version namespace....

Web Service Woes

Only now do I really get this image from DHH's blog. I am really beginning to despise SOAP for some reason, but I guess I will "get it" as I learn more about it -- as it seems to be the only way to do business with the big players out there. For a glimpse of some of my hell, check out this Ruby + SOAP4R + WSDL Hell article. The bad news aside, I was really happy to find...

HomeMarks, My First Ruby On Rails Pet Project

UPDATE: HomeMarks is no longer an open source project available to download. I've heard that the best web applications are ones that usually start as a simple tool that meets the needs of its creator, in this case, myself. I have always been close to Web Developers that code their own HTML start pages with links to the projects they are working on. So when the time came for me to really get serious with my programing career using RAILS,...

Custom Rake Task To Unload Fixtures

I made a revised version of a rake task that I have used quite often, for unloading existing DB tables into fixture data and thought I would share. This rake task is the in correct name space and adds a "rake db:fixtures:unload" command to your rails project when you put this in "lib/tasks/foo.rake". It can take an optional TABLES variable or if none is present the whole array of DB tables are converted. I find this rake task helpful when...

My Own Soup to Nuts Recipe for Ruby on Rails on OS X

Tim Toady tells us that (There Is More Than One Way To Do It) and I am sure this is not the first and not likely the last blog post you will ever see that tells you the best way to install RAILS on OS X. Some people would just rather than go the simple path but I implore you, do it this way. Gaining the experience of compiling your own software will help you down the road when it...

Pragmatic Studio Alumni Member

Well, I just got back this past weekend from the Pragmatic Studio in Boston and it was well worth the time and effort. If you have not yet used the RoR framework for web applications, stay tuned to my next post. By next week I will lay out an extensive tutorial on how to install the framework with all the proper goodies on your Mac. So do not wimp out and go for that easy package install and dare to...

Learn To Program in Ruby and Basic SQL

I've been learning to or "trying to learn" Ruby on Rails for a few months now and things have always kept me from finishing the book that I purchased from those great publishers at the pragmatic bookshelf. My problem has been that sometimes other work has gotten in the way, but mostly it was because I did not have the core understanding of the basics for building web applications. Especially in the areas of object oriented programming and database languages....