Browsing all articles from September, 2010

Running rails migrations in other databases

Posted Posted by Wes in Ruby on Rails     Comments 4 comments
Sep
24

We have a set of Ruby on Rails applications that shares user logins, so we put that table in a database and connect to it from each application.

If an app needs to add a column to the shared table, you can create a migration that accesses that other database.

First, create an entry in your database.yml file (we name ours “user_development”, etc.).

Then, establish that connection in your database migration and do your migration stuff:

This has the benefit of keeping all the migrations local to the app they’re needed for, but it stores the schema of the users table in the users database where it belongs.

Converting erb to haml in rails3

Posted Posted by Wes in Ruby, Ruby on Rails     Comments 1 comment
Sep
19

I’m taking over a project that’s just started and prefer to use haml. In setting up my environment to work with rails3 and haml, here’s the best way I found to convert the fledgling app to haml.

Install gems

Run this

This will convert all .erb files in app/views into .haml files right next to them, leaving the originals in case you need to refer to them to fix somethig the converter missed.

This isn’t rails 3 specific, except for the Gemfile part, really.

rspec2, rails3, and spork with drb to get faster tests

Posted Posted by Wes in Ruby, Ruby on Rails     Comments 1 comment
Sep
17

I started using rspec2 and rails3 on a project and wanted faster tests.

Gemfile:
gem 'spork'

bundle install

spork --bootstrap

Bootstrapping will edit your spec_helper.rb file with some instructions. I had a vanilla spec_helper file, so everything got moved into the Spork.prefork block.

Also, I’m using autotest, so I added --drb to my .rspec file.

Finally:

spork &
autotest

I only had 15 tests at the time that I did this, but they went from running in 6 seconds to running in 1.5 seconds. Significant.

UPDATE:

From the comments, here’s a fix for running rake on Windows (“can’t find executable rake”):

Godaddy: Common name my.domain.com is already present in a current certificate

Posted Posted by Wes in Sysadmin     Comments No comments
Sep
13

When submitting a CSR for creating a new SSL certificate on godaddy.com I received this error:

Common name my.domain.com is already present in a current certificate

For those searching for a quick answer: you need to renew the other certificate or get it revoked.

I took this site over from another developer, so I didn’t have access to the SSL account that he used to purchase the certificate.

My first call to general support told me I would have to prove an interest in the domain name, either through knowing the account login or some other method, like altering a DNS record or something. He bounced me to SSL support for future help.

Called godaddy SSL support (480-505-8852) and they said:

The current certificate needs to be revoked, so current owner of domain needs to get involved. I asked if the DNS option was a possibility, because trying to get an email to a no-longer-there contact’s email address sent on to me reliably could be problematic.

After talking to a supervisor, I gave them my email address and they sent me an email:

We need to validate your domain access or control.

Your domain’s WHOIS record does not present a valid registrant and/or administrative email address, you will need to complete domain control verification.

There are several alternative methods you can choose from below to complete domain control verification.

This is a special code for you to use when completing one of the two methods below: abc123

Domain Zone Control

Access your domain name’s DNS control panel and create a CNAME using the special code as the hostname. The points-to address does not matter. CNAME = abc123.mydomain.com

Website Control Validation

Create a webpage on your root domain using the special code above. Example: your domain name is mydomain.com and if the code is abc123 , you would create a webpage named abc123.html and upload it to the root domain so it resolves as mydomain.com/abc123.html. You must use html as the page extension.

************************************************
The webpage will also need to contain the special code in the body. We will not accept a blank page.
************************************************

I replied to that email after setting up the CNAME and making sure it worked.

I waited the requested 15 minutes and called back in to get a status update. The customer service rep grabbed a supervisor and they submitted it and I got on with my SSL request.

Using Factory Girl with Rails 3

Posted Posted by Wes in Programming, Ruby, Ruby on Rails     Comments 1 comment
Sep
7

Setting up a new project, I couldn’t get FactoryGirl working. From the README:

If you want to use factory_girl with Rails 3, see http://github.com/thoughtbot/factory_girl_rails

I added this to my Gemfile:

gem 'factory_girl_rails'

A bundle install to install and done.

Note: I’m using rspec2 and putting my factories in spec/factories/*_factory.rb and I’ve seen references to spec/support/factories/*_factory.rb as well. I’m not sure if either is the blessed location.

Back Up, People!

Posted Posted by Kevin in Blog     Comments No comments
Sep
2

It’s easy. It’s safe. It’s secure.

Did you know that 93% of all companies that suffer significant data loss close down within 5 years!?

Even if you just have a home computer you likely have someĀ  family photos, music, term papers, and financial data. What happens if you lose all of it?

Personal Computer Backup

Business Computer and Server Backup

Or contact us for consulting and help customizing the right solution for you.

about databasically

We live and work in Kansas City, USA.

We're passionate about helping small businesses succeed and want to help you use technology to get more done.

From server, desktop, network management to programming custom web applications in Ruby on Rails, we're here to lend a hand.

Contact us if you have any questions!