Recent Posts

Multiple Database Connections in Ruby on Rails

October 05, 2007

We have a client that already has some database replication going on in their deployment and needed to have most of their Ruby on Rails application pull from slave servers, but the few writes would go to the master, which would then end up in their slaves.

So, I was able to quickly extend ActiveRecord with just two methods to achieve this. Anyhow, earlier today, someone in #caboose asked if there was any solutions to this and it prompted me to finally package this up into a quick and dirty Rails plugin.

Introducing… Active Delegate!

To install, do the following:

cd vendor/plugins;
piston import http://svn.planetargon.org/rails/plugins/active_delegate
```text
Next, you'll need to create another database entry in your
`database.yml`.

```yaml
login: &login
  adapter: postgresql
  host: localhost
  port: 5432

development:
  database: rubyurl_development
  <<: *login

test:
  database: rubyurl_test
  <<: *login

production:
  database: rubyurl_servant
  <<: *login

# NOTICE THE NEXT ENTRY/KEY
master_database:
  database: rubyurl_master
  <<: *login
````ruby
At this point, your Rails application won't talk to the
`master_database`, because nothing is being told to connect to it. So,
the current solution with Active Delegate is to create an ActiveRecord
model that will act as a connection handler.

````ruby
# app/models/master_database.rb
class MasterDatabase < ActiveRecord::Base
  handles_connection_for :master_database # <-- this matches the key from our database.yml
end  
```text
Now, in the model(s) that we'll want to have talk to this database,
we'll do add the following.

````ruby
# app/models/animal.rb
class Animal < ActiveRecord::Base
   delegates_connection_to :master_database, :on => [:create, :save, :destroy]
end

Now, when your application performs a create, save, or destroy, it’ll talk to the master database and your find calls will retrieve data from your servant database.

It’s late on a Friday afternoon and I felt compelled to toss this up for everyone. I think that this could be improved quite a bit, but it’s working great for the original problem that needed to be solved.

If you have feedback and/or bugs, please send us tickets.

PLANET ARGON is seeking fresh talent... could it be you?

October 04, 2007

My blog has been fairly quiet lately because our team has been busy helping push a few big client projects out the door. We’ll be posting announcements about those launches on the PLANET ARGON Blog soon, so stay-tuned there!

We’ve been growing the design-side of our team lately, but we’re also still seeking some more Rails-talent in Portland, OR. If you’re in Portland or interested in moving here[^1^](#fn1){#fnref1 .footnote-ref role=”doc-noteref”}, you should introduce yourself to our team. We’re looking for people to work on-site in Portland, so any remote candidates will be turned away… we’re moving into a shiny and new office space in downtown and are looking for another developer to join our Design and Development team.

PLANET ARGON goes
hiking{width=”333” height=”500”}
[you’ll fit in really well if you’re into outdoor activities… ;-)]{.small}

We’re seeking mid-level Ruby on Rails developers that can pick things up quickly. Having some experience with RSpec will go along way with us. Ideal candidates would have great communication skills and be able to work in a fast-paced environment that places a huge emphasis on collaboration between designers and developers (let’s not forget to mention our clients). Bring what you already know and learn the rest with us.


[While everyone might have Wii’s in the office, we’ve taken it to the next level with Speed Stacking! :-p]{.small}

To apply, send an email to <af22+8509@c1.catchthebest.com>,

Side note: We’re giving Catch the Best a whirl to review job candidates. If you’re hiring people, you might consider giving it a try.


  1. ::: {#fn1}
Everybody is moving to Portland... ;-)[↩︎](#fnref1){.footnote-back
role="doc-backlink"}
:::

Edge Rails Documentation: Revisited

September 26, 2007

This question, “where can I find documentation for Edge Rails?” still comes up quite often on mailing lists, IRC, and other places. I just wanted to point out a few resources for you.

In March 2006, our team announced that we’d be updating a RDOC site a few times a day as the Rails project gets commits.

You can still access the PLANET ARGON Edge Rails documentation here:

Caboose also has some Edge Rails documentation here:

If you’re aware of any other online resources for Edge Rails documentation, please let me know.

Rails Business: 'Weekly' Review #4

September 25, 2007

As I mentioned in my last review, I wouldn’t be updating on a weekly basis, which is a shame because there are so many fascinating discussions going on that might benefit you if you’re running a business that uses and/or relies on the Ruby on Rails framework. I’d like to highlight some of the discussions that have been taking place over the past month or so.

First off… wow! As of this morning, there are *650 members!

Some Recent Discussions

Obtaining Ruby Gigs

Johan Pretorius started a discussion with the following…

“I’ve been lurking on the group for a while now, the time has come to participate … What strategy would you recommend for somebody that wants to break into the Ruby (on Rails) market?”

On a related topic, Jose Hurtado started a discussion asking for tips on how to get a reputation in the Ruby on Rails community for you business.

Some of the responses included:

  • Start a portfolio
  • Contribute to Open Source projects
  • Contribute to Rails through Documentation
  • Subcontract through well-known developers
  • Start a blog
  • Write a book

Read the entire thread and please share any other ideas that you have on this topic with Johan, Jose, and rest of the list. :-)

Taking a full-time job, what about your freelance clients?

Oren writes, “I got a full-time job offer as employee (and not on as a contractor). My current client might need some help on the weekends in the next month, so I might still do contract work. Can I keep my corporation (corp S) while working full time?”

Read the responses

Reality Check!

Starting your own business might sound like an amazing thing to do, but it often comes with a lot of consequences and struggles, which I’m definitely not been immune to.

Michael M. writes, “…added to having to create a company, perform customer support, continue to grow the features, marketing, and the loads of other things I haven’t thought of yet…is there any hope that one person can pull this off while still working at my current job ( with hopes of going it alone when I’m sure it can fly ), and giving time to my family, with very little up front costs. I’ve been reading quite a bit about bootstrapping lately, but to really make the time has been very difficult.”

There were several thoughtful responses where well-known members of the Ruby on Rails community, such as Joe O’Brien Ben Curtis shared through personal experiences.

Joe O’Brien wrote, “I wanted to mainly chime in on the family part. Something that has taken a year for me to figure out how to balance. I would not have been able to do any of it, had it not been for my wife’s full support. I have three kids, all of whom I love spending time with, so figuring out a way to balance it all has been very tricky. Up front though, my wife and I knew this would not be your typical job. It helped that I used to travel and now do not, but it has still been an
adjustment.”

If you’ve been running your own Rails business, please consider responding to this thread and sharing your experience.

Join the Community

As mentioned, this is just a small sample of some of the great discussions taking place on the Rails Business mailing list. If you’re an aspiring Rails freelancer or business owner, be sure to join the community and share your experiences and learn from other members of the community that are willing to share theirs.

As always, have fun!

Boxcar: Open for business

September 04, 2007

We’ve been quietly rolling out our new Rails hosting solution over the past month, each week… inviting more people to ask questions and place orders. Initially, we invited some of our business hosting customers, and then sent out invites to those who signed up on the Rails Boxcar announcement list. We’ve been taking orders for the past few weeks and have had sites running on Boxcar for over a month now.

You’ll also notice that we’ve begun to phase out all of our older shared hosting solutions for new customers and are focusing solely on our Business and Boxcar accounts (aside from custom managed/dedicated solutions that we’ve been offering upon request).

To learn more about Rails Boxcar, read the announcement on the PLANET ARGON blog.

In other news, Daniel Johnson, our Lead Systems Administrator broke his arm while riding his bike while participating in Zoo Bomb (and cracked his helmet in the process). He’s at home today on pain medicine and we hope that he has a swift recovery.

RubyURL bookmarklet 2.0

August 28, 2007

If you’re using the bookmarklet for RubyURL, you will want to update it with the latest version as there was apparently a bug in the JavaScript and some URLs would fail to redirect properly. Thanks to the help of Jerome, this is now fixed.

So, head over to RubyURL and update your bookmarket. Not sure what I’m talking about? Watch the video.

Rails Development Performance Tip - dev_mode_performance_fixes

August 28, 2007

When you’re running a Rails application in development mode, you might notice that it takes a little longer for requests to get processed and this is somewhat intentional as the framework is was designed to allow you to run the application and make live changes to it. This way you can do some basic functional tests from your web browser, work on HTML/CSS changes, or anything else that might need to be done in development mode.

Anyhow, this can be slow from time to time and if you’ve done much Ajax work, you might be familiar with how slow this can feel when performing some basic tasks. Well, thanks to Josh Goebel, we can speed up things with a new plugin he just released.

To install via piston:

Collaborative Bookmarking... UNLEASHED

August 21, 2007

Like many… I’ve been using del.icio.us for several years and so have some of my closest colleagues. A few of us at PLANET ARGON have been using the for:username tag to send each other links, which has been a great productivity hack as we don’t need to copy URLs and paste them into emails, IMs, or IRC channel windows anymore. One of the things that del.icio.us doesn’t have a totally perfect implementation is sending to a group. There are people in your network, but to my knowledge, there isn’t a way to send everyone in a network the same link without selecting everyone individually. This was adding more time to the process of saving a link for ourselves and our fellow team members. So, we came up with a clever hack… a new delicious user account.

Over the past four months, our team has bookmarked almost four hundred links on topics ranging from Rails plugins, Interaction Design, Business processes, cool new web applications, to any variety of things that we find relevant to our team.

So, all of the links are being sent to a fake user. How do we see the links for that user without having to logout of our current user and into the planetargon account? Well, what we’ve done is take the delicious RSS feed and pipe it through feedburner and given everyone the URL that feedburner provides. Now, we’re all able to subscribe to the same feed and check out links when each of us has time for it.

…and this is what I get to see show up in my RSS reader. :-)

How is your team managing bookmarks? :-)

Subscribe to Basecamp RSS Feeds in Google Reader

August 17, 2007

Yesterday afternoon, we were helping our newest employee, Paige Saez, get setup with new accounts across all of our applications. She uses Google Reader and couldn’t understand why her Basecamp RSS wasn’t working in it. We explained that Google doesn’t provide any way to subscribe to authenticated feeds (yet)… so it wasn’t something she could do. (I still use NetNewsWire because of this problem…)

During the discussion, I said that it probably wouldn’t take much effort to build a proxy for an authenticated feed… and Andy said he’d give it a shot.

10 minutes later… he had an initial version of a RSS proxy application, written in Ruby.

15 minutes after that, we had it up and running on a private server for all of us at PLANET ARGON to begin using.

…and here is the proof!

Wee! Authenticated Basecamp RSS feeds in Google reader. It even works with the openid authentication.

You can grab the code from Andy’s blog post and finally make the switch off of desktop RSS readers to Google Reader, because you know you want to. ;-)

Thanks Andy!

RubyURL: new design and code base

August 08, 2007

Yesterday evening, I deployed the new version of RubyURL. This was a collaborative effort between Chris Griffin and I, which we’re happy to finally push live.

There are a few things that we’re going to push out in near future, such as an API and a new RubyGem.

RubyURL » Keep it short (and
sweet){width=”500” height=”458”}

Chris volunteered to work on the new design and I did most of the programming in Ruby on Rails. When we worked on this, we really wanted to keep the process as simple as possible, despite some of the problems that the site has been having.

In the end, we have a Rails application that is only 85 lines of code and has a 1:2.3 code-to-spec ratio. I wanted to keep it under 100 lines of code. This means that there is some breathing room for further development.

We also tried out a beta account that I was given for RoundHaus for Subversion hosting. We had a really good experience using their service and were impressed by the plethora of useful features that came with the repository, such as continuous integration, rcov/code coverage stats, and twitter integration!.

If you find a bug, be sure to submit a ticket on the RubyURL bug tracker.

On a side note, we deployed this on a brand new Rails Boxcar, our new hosting solution that will be launched in the very near future. ;-)

Rails Business: 'Weekly' Review #3

August 05, 2007

It’s been about six weeks since the last Rails Business “Weekly” Review on here, so perhaps it’s worth changing the name to cut me some slack on not being consistent. ;-)

Since the last post, we’ve gone from around 400 members to 555 as of this morning. We’ve had 562 messages as well, so there hasn’t been a shortage of discussions taking place. I’d like to take a few moments to highlight some of the discussions that have taken place and encourage you all to consider participating, if you’re not already.

Licensing and Client Agreements

Tim Case writes,

“My client sent me this agreement drawn up from their lawyer that
included the following:



© the Contractor shall not bundle with or incorporate into any Work
Product any third-party products, ideas, processes, software, codes,
data, techniques, names, images, or other items or properties without
the express, written prior approval of the Company;”

Tim then goes on to ask how his applies to using Ruby on Rails, which as a MIT license and how other consultancies are handling these types of situations. Follow the discussion…

Escrow

Gustin writes, “Does anyone have any escrow experience, legal and cost? I am dealing with a client that got burned bad and we are reducing their fear with escrow on the first two iterations.”

Follow the discussion…

Project Planning tools

Mike Pence writes, “So, I used to use MS Project for the composition of those dreaded Gantt charts, but it has been a few years since I had to be so formal. Anything new and exciting - and more robust than Basecamp - happening in the world of project planning software?”

Follow the discussion…

Not long after, Jim Mulholland started a new thread on the same topic and brought up the open source application, redMine. Follow this discussion…

Ruby on Rails versus .NET

Michael Breen asked a big question on the list, which has sparked an going discussion about the benefits of using Rails versus .NET (and other platforms).

“A couple of months ago I decided to stop actively pursuing .NET gigs to focus on Rails. Several of my existing .NET clients have learned of this through the grapevine and have contacted me to discuss.”

Follow the discussion…

Three things Tim’s learned from Freelancing Rails

Tim Case shared his experience of freelancing with Ruby on Rails and highlights three things that he’s learned.

  • The non-code business aspect of Freelancing is demanding.
  • It takes 10 hours to bill 6 to 8.
  • Figuring out your rate is hard.

Read the rest of Tim’s observations and the discussion the followed.

Client issue tracking and documentation

Jeff Judge writes, “Hello all! I was curious to here how people are handling client issue tracking and documentation.”

Several applications were mentioned for handling issue tracking and the general consensus was that there was still a lot to be desired that current options didn’t provide. Be sure to follow the discussions…

Join the Community

These were just a small handfull of the discussions that have taken place over the past several weeks. If you’re an aspiring Rails freelancer or business owner, be sure to join the community and share your experiences and learn from other members of the community that are willing to share theirs.

Until next time, have fun!