Verbose Logging

software development with some really amazing hair

T + S G I F R

Articles tagged with "rails"

NewRelic with Rails 2.3.x and Sinatra Metal Controllers

· Posted in Software
Our application at Yardstick is Rails 2.3.x, and we use some Sinatra based metal controllers. We also use NewRelic to monitor things. Get Low Something got updated somewhere, maybe the NewRelic gem, maybe something else. Our Apdex hit 0.3 or something stupid and stayed there. After a long debugging period going back and forth with the NewRelic folks, we figured it out. Problem, meet Solution The way a metal controller in Rails 2.3 works is that …

RubyConf Mission Complete

· Posted in Editorial
RubyConf 2012 is at an end, and what a time it was. This was my first conference, and it was all thanks to my employer Yardstick. If it wasn’t for them, I probably wouldn’t have been able to come, learn so much, and meet so many great people. My mission was to thank as many people as possible, in person. Open source is somewhat of a thankless job. Lots of people using your code or what have you, and never receiving thanks for it. While I didn’t …

My RubyConf Mission: Thank All The People!

· Posted in Editorial
Are you excited for RubyConf? I am! It’s my first time, and it’s made possible by my awesome employer, Yardstick. Thanks Yardstick! I’m excited for the talks, though there are some time slots where it’s going to be tough to pick which talk to go to! Luckily, Confreaks records everything so I can always watch it later! Thanks Confreaks! See the pattern? Two paragraphs, two thank yous. But I want more. I want to thank you I want to meet you at Rub…

Easy Sinatra Metal For Rails 3.x

· Posted in Programming
I was doing some optimizing the other day on a Rails 2.3.x application with a metal controller. I didn't feel like writing a straight rack application, so I used sinatra. A pretty good explanation of how this works can be seen in Adam Wiggins' slides: Rails Metal, Rack, and Sinatra from Adam Wiggins In Rails 3, they still have metal controllers, in that the ActionController::Metal class is essentially a really thin controller, and you can use it…

Deploying Your Ruby App With Mongrel2

· Posted in Software
If you're in the ruby world, and specifically the web side of the ruby world (Rails, Sinatra, etc), you should probably know who Zed Shaw is. I mean, he only wrote mongrel, which you're probably using as your application server. Well, he's been hard at work on Mongrel2, and it's a big change from the original mongrel. Mongrel2 isn't a ruby web server. It's (and I'm going to borrow straight from the site): Mongrel2 is an application, language, an…

Rails Rumble Immediate Post Mortem

· Posted in Programming
It's 10 minutes past 6 on Sunday evening, and we just wrapped up our Rails Rumble 2010 project. Check it out at http://gemrage.com/. Check out our team here too. This. Shit. Was. Real. We had a rough start with lack of internet for 3 hours, had a few depressing times thinking we'd never finish, but we rocked our socks off with Windows and Internet Explorer, MacBooks, Twitter and Campfire, and produced a pretty cool application. Please go check o…

Most Dangerous Programming Errors, 10-6

· Posted in Programming
It's been a while, but we're continuing the Top 25 Most Dangerous Software Errors with numbers 10-6. 10. Missing Encryption of Sensitive Data Have you ever signed up for some website or service, only to receive an email 30 seconds later WITH YOUR PASSWORD IN IT! Doesn't it just fucking kill you? Have you ever used a 'Forgot your password' page only to be blindly given your password? Fantastic. I highly doubt they are doing any encryption with yo…

Find Queries Missing Indexes In Your Rails Application

· Posted in Programming
Rails developers aren't exactly known for getting their indexes right (or even at all) on their databases. Granted, databases are a tough subject, and some people and companies make their living dealing with only databases, and some only with one database (like MySQL or Oracle). If you're coming to web development with no formal background in databases, and it's all new to you, then it's totally understandable to maybe forget about indexes initi…

Getting Rid Of Transactions For The Poor Man

· Posted in Programming
A quick post for today. Want to get rid of transactions from ActiveRecord for something? Here's a cheap way to do it. It only works for MySQL obviously, but you can roll your own if you are on postgres. I'll make it a bit less crappy and make it a gem or something.

My Watch List, Into 2010

· Posted in Software
Lots of interesting things are afoot, and I try to keep track of them. Here's what I'm watching. Rails 3 Lots of new changes are coming with Rails 3, and it's pretty exciting. I wrote about some of the cool ones here. Rails is shaping up to be faster, more modular, and generally better and easier to work with. With all the smart people working on it, you don't have to look very hard to realize this is going to be a big release, and is only going…

Rails 3 Release Notes: What Does It Mean To You?

· Posted in Software
The Rails 3 Beta got dropped a few days ago, and the release notes for Rails were put out a bit before that. The list of changes is long; this is a big release. There's a lot to sift through, a lot to change to upgrade your existing application, and a lot to learn whether you are upgrading or starting a new app. The big question is: WTF does all this mean to me? Don't worry, I'm going to tell you. If you want to read the full release notes, go f…

respond_to With respond_glue: Override respond_to

· Posted in Programming
So check this: you have a nice little Rails app. You have some stuff for a JSON API type system. You've got an STI setup with the Widget model class and the more concrete FancyWidget and WeirdWidget classes. You've got a WidgetsController, and the corresponding FancyWidgetsController and WeirdWidgetsController Yay. It works. You can deal with both types of Widgets using JSON. Now you need an HTML interface to it. Fine, you can just throw in a fo…

role_on: Really Simple Roles (For Rails)

· Posted in Programming
I looked at a few role systems for Rails, but never found what I wanted. They were all object based systems, never just "allow a user with this role to do this action". Either that or I never found the systems that did that, or totally missed the docs on how to configure those systems to do what I wanted. Well, actually acl9 seemed to do that, but whatever. So I made role_on The instructions are on Github, so I won't repeat them here, but it's p…

Useful Links Of The Evening

· Posted in Links
Ruby on Rails content_for Project: Builder RSS pauldix-feedzirra Basic Rails association cardinality Nested Object Form with has_one Relation

Debugging Cucumber On Rails

· Posted in Programming
I like frameworks, but sometimes debugging them is more entertaining. I don't know why I didn't think of this method before, but mischa on github has a great little repo showing how you can do it. The README Usage: Add: require 'ruby-debug' require 'cucumber_rails_debug/steps' To features/support/env.rb Then use: Then debug # opens the debugger or Then what # prints out params, url and html Check it out here

Riding Rails With Selenium

· Posted in Programming
Selenium is a suite of tools to automate web app testing across many platforms. Cucumber is a BDD framework that allows you to write things in English (or whatever language you want, really), and have that execute as code. Put those together with webrat and rspec and you have a pretty mean stack to test your ruby on rails web application with. Sort of. I've been having some problems with it, getting it set up, but it's coming along. This isn't a…

ruby-openid IOError With Passenger

· Posted in Programming
The ruby-openid gem was giving me problems with Passenger, causing IOError problems. I found the fix here The gist of it? Add OpenID::Util.logger = RAILS_DEFAULT_LOGGER to environment.rb, and you're good!