Archive

Archive for the ‘Ruby on Rails’ Category

Twitter is giving Rails a bad name

June 5th, 2008 tony 2 comments

twitterificUggh. Rebuild it already. Its only a few actions. It wasn’t built for this kind of app.

Python, C, Perl, whatever.

Categories: Ruby on Rails, Social Networks Tags:

Easy Solution for Conflicting Rails Migration Version Numbering

March 2nd, 2008 tony 1 comment

migrations numbers
Thats a crappy blog post title but the best I could come up with! You know the scenario: you are about to commit your latest Rails code to subversion and you perform an update first. Rats. Someone has committed a new migration with the same number as yours. So you mess around with SQL manually reversing changes, and rename files. Its a pain, and I think this single problem with Rails causes much stress because as Rails developers we are used to everything working so smoothly. We’ll Steve Purcell has solved this problem in a beautiful way.

Install his plugin ‘renumber_migrations’:
script/plugin install http://rails.sanityinc.com/plugins/renumber_migrations/

Next time you run into this migrations mess:
rake db:migrate:renumber

Problem solved!

One note: for some reason I couldn’t get it to work until I removed line 18:
raise "This task currently supports only subversion projects"

Don’t know why he added that line but once it was removed it worked perfectly. Thank you very much Steve! Now if someone will write a nice script to setup a bunch of common ignore properties (log/, schema.rb, tmp/) in SVN when first importing a new Rails project…. :)

Categories: Code, Ruby on Rails Tags:

Ad Blockers can Ruin Your Legitimate Web App that Isn’t Even Serving Ads

November 21st, 2007 tony 2 comments

Since rebranding some of our old classifieds sites and relaunching the system as OhSoHandy.com in a newly built Ruby on Rails app we’ve received a handful of emails complaining about strange behavior that always involved links not appearing for the user.

How do you read the rest of the postings or see any pictures that were uploaded?!?! There are no links on the classifieds to keep reading them. Please help since I am new to the website.

At first I discounted this as user error. “These fools don’t know how to use the internets!” DELETE.
Read more…

Categories: Code, Ruby on Rails Tags:

Ruby runs on iPhone

September 19th, 2007 tony 3 comments

Peter Cooper pondered Ruby on iPhone?…. Giles has no iPhone, and nor do I, so we can’t test it,…”.

Yes it works:

And for any skeptics all doubt should be cleared up with this horrifically blurry, bad video I made with the only camera I had here at the office (iSight) :)

Categories: Ruby on Rails, iPhone Tags:

New columns not immediately available in migrations

July 4th, 2007 tony 4 comments

Sometimes you add a column to a table in a migration and then you want populate the new column with some data. Run your migration and while your column has been created in the database, your data does not populate. The problem is that those columns are not accessible via ActiveRecord and so you just need to tell it to update itself:

add_column :user, :favorite_beer, :string
User.reset_column_information  #<<<<<<<< Here is the ActiveRecord reload
tony = User.find_by_name "Tony Spencer"
tony.favorite_beer = "Terrapin Rye Pale Ale"
tony.save
Categories: Code, Ruby on Rails Tags: