Posts Tagged ‘rails’

RailsConf Reflections

Released May 24th, 2011

Today, I’m feeling mostly recovered from my first ever RailsConf, so I thought I would take some time to reflect on what I learned there, and share it with you, my dear reader. So, here we go, in no particular order…

CoffeeScript is happening…

…whether you like it or not. Personally, I’m psyched — it looks like it solves a lot of the annoyances I’ve had with Javascript syntax, and I got a sweet deal on CoffeeScript: Accelerated JavaScript Development during the conference, which I hope to put to good use starting this week.

The Rails Community is Awesome

My wife’s response after she read my tweets upon my return:

“Just wondered, who is this guy? Dinner anyone? Share a cab? You became an extrovert on your mothership.”

It’s true, I did. It’s weird. I’ve never been to Baltimore before (save time spent between flights at BWI), but among my fellow Rails coders, I’ve never felt more “at home.”

As I thought about all of the people I finally got to thank in person for all they’ve done to make my time in the Rails community more enjoyable, it really drove home what an awesome community we have. It’s easy to lose sight of this while working away in Louisville, my little corner of Kentucky.

Aside from this, getting a chance to put a real face to a name, make and receive thank-yous for all the hard work we put in on Rails patches, plugins, and the like, has the effect of re-energizing a developer. I’d go on and list all of the awesome people I got to meet in person here, but I think it’d just make @casron more jealous.

I would like to say, however, that Emilio Tagua (@miloops) has got to be one of the friendliest guys I’ve ever met. I’d hoped to catch up with him to thank him for helping me get commits added to ARel back in the 1.x days that were needed for MetaSearch and MetaWhere. Instead, he ended up two seats over from me at Ignite, noticed I was hacking on a Squeel bug, and introduced himself first. Every time I saw him during the remainder of the conference, he had a smile and a kind word. Just an all-around great guy to have met.

PostgreSQL is awesome, too!

Now, I should have known this. I had started out using MySQL many years ago, when it had solid speed advantages over PostgreSQL, but far fewer features. Somewhere along the line, that balance shifted, but I stuck with MySQL due to familiarity. Nick Gauthier’s KnowSQL presentation has made a believer out of me. I’ll be using PostgreSQL as my RDBMS of choice from here on, and making sure that Squeel works as well as possible with it, too.

The Fundamentals are ALWAYS Relevant

There were tons of talks on design patterns, best practices, and so on, and even as long as I’ve been doing this whole coding thing, there are plenty of areas in which I can improve. In particular, Avdi Grimm’s talk, Confident Code, José Valim’s talk about the design principles behind the Rails 3 refactoring, and the talk on Building Bulletproof Views by John Athayde and Bruce Williams all challenged me to elevate my game in these areas.

HTML5 is sooooo much more than semantic tags

LocalStorage, audio, video, canvas drawing, web sockets, web workers — this stuff is all crazy cool and I can’t wait until more browsers support it. Mike Subelsky’s HTML5 tutorial was a real eye-opener.

That’s about it, for now. What were some of your takeaways from RailsConf this year?

Rails fixtures with models using set_table_name

Released April 22nd, 2007

If you have a model that uses set_table_name you may hit a snag when trying to use fixtures and unit tests. The solution is twofold: name the fixture file using the legacy table name, and use the set_fixture_class method in your unit test. I coudn’t find this method mentioned in Agile Web Development with Rails, and there’s only a brief mention on the rubyonrails.com site. Still, some web searches turned up the answers.

Here is a simple example:

(more…)

Latest on Rails Performance

Released April 1st, 2007

Updated Rails 1.2 performance numbers have been released. While these number look pretty good it is hard to get a good idea of exactly what the performance of Rails is. A couple of other benchmarks that include Rails such as performance tests for 6 frameworks and Grails vs Rails benchmarks show a different picture. Both of these come up with much worse performance than the first. Maybe the issue is that the second two benchmarks are using Apache ab but the first uses a new version of rails bench. Of course most people probably aren’t that worried about the benchmarks that much because you can find ways to make anything fast as shown with Rails doing 4000 requests a second.

Cleaning Up Rails Sessions, Revisited

Released September 16th, 2006

In an earlier post, we detailed a method for removing stale Rails session files. In more recent version of Rails, there is a Rake task built in for this administration task.

rake tmp:sessions:clear # Clears all files in tmp/sessions

Cleaning up stale rails sessions (removing ruby_sess files)

Released June 8th, 2006

I’m not sure if something isn’t set up correctly of if this is just a fact of life with rails but the sessions it creates never seem to go away. I think before rails 1.1 the sessions where stored in /tmp and now they are stored in the apps directory along with everything else so they is probably no internal mechanism to delete them. I only noticed because after about a month of an certain app running the disk on the machine started to fill up. After digging a little I found 50K ruby_sess.* files hanging out in the rails session directory.

Anyway it was easy enough to clean up the stale ruby_sess files by going into the rails webapp/session directory and then running the following command:

find -type f -name "ruby_sess*" -exec rm -f {} \;

I’m not sure why the app is creating sessions but it isn’t something that stores state so I didn’t have to worry about killing active sessions here. If you do need to worry about that you will probably want to toss a time on the find command.

After looking a little more I found a post about this that has a ruby way of cleaning up the sessions.