• Ransack Integration Test

    In my efforts to test the right stuff, I wanted to test that my basic search was working properly. I have a collection of plates that we’re storing a bunch of information on. Each plate has a unique serial number. We also have a unique id for each plate, but for our users, the serial number is what they’ll use to identify it. So I wanted to make a form that would let people search for a particular plate based on the serial number. And since this search form will be on my home controller and not the plate controller, I need to use an integration test to do this.

  • Interesting Evening

    I spent the evening poking around The National Archives. I found some neat images that I downloaded. I did a search for Theodore Roosevelt, because I’m currently reading a biography of him and I’ve been fascinated with him since I visited his birthplace a few years ago. And I searched for Thomas Edison because he’s always been one of my favorite people.

  • Dropdown Lists

    In the event that I want to make a simple dropdown list in a form in rails, I can use this:

  • IPhone Saga Continues

    I was feeling pretty full of myself after replacing the screen on my iphone. Alas, I now have new troubles. It seems that my iphone thinks that headphones are plugged in all the time. This means that I cannot take calls, listen or speak on my phone without putting it on speaker. I thought that this was related to my changing the screen, but I don’t think it is. First of all, I didn’t have this problem after I replaced the screen. It appeared about a week later. Secondly, I searched this issue online and found that lots of people have it. Just another great apple product.

  • Typical Weekend

    As I spend most weekends, I was working at my house today. I met my contractor in the morning to discuss putting in the back door. He’d rather just come back one more time to finish everything, so I have to buy my lights and then give him a call. So, I may be able to get all that done in a few weeks. Good thing I did my taxes, so I’ll have a little money to buy the lights.

  • A Full Day

    Earlier this week, I had a bad day. I had two cars that I couldn’t drive, my bike had a flat, my iphone was in pieces, the power supply for my laptop was working sporadically (ended up buying a new one) and I was dreading doing my taxes. Today is much, much better.

  • Ransack Gem

    Recently, I started using the ransack gem (https://github.com/ernie/ransack) for searching in one of my apps. I’m putting this here as an example, in case I ever need to make any more changes. The basics of ransack are pretty easy to do and work decently well. First step, add a search method to your controller. It should look something like this:

  • Ready for Grout

    I didn’t feel like posting yet another pictures of the floor in my kitchen. However, it is now done, up to the back door. The next step is grouting. I’m debating whether I should grout or wait until I finish the whole thing before grouting. Either way, the tiles are all in. Took a while, but I think it looks pretty good.

  • Just Get Started

    I could be messing around with arranging tiles on the kitchen floor for years. I finally decided that I just need to set the tile and see how it turns out. If I make a mistake, so be it. I’ll figure out a way to fix it. So I spent today setting tile. I have about half of the area done that I want to do. I could have probably done the entire kitchen, but realized that this would block access to my bathroom. This meant that I couldn’t get to either bathroom in the house. The upstairs one is blocked because I started sanding the stairs. Blocking the downstairs one just seemed like a stupid idea. So I did half the area, to leave a path. I’ll do the other half after I can walk on the tile I just installed. So, here’s how things look so far.

  • Floor Progress

    Here’s where I am on the floor.

  • Routes

    I’m working on a new app for work. Basically, it’s just another app that lets people put up some info and an image to go with it. The difference to this one is that I’m storing information on glass plates, which each have a unique identifier that’s not an integer. I didn’t want to mess around with changing the primary key from id to something else, because later I’m going to be using it with some other tables. Instead, what I’d like to do is be able to show the image associated with the plate at a url that uses the unique identifier. So, instead of something like plates/12, I could download the info at sample/538-12122. Here’s what I did.

  • Little Work Over Weekend

    I fixed most of the bad boards in the subfloor of the kitchen. And cut out some cement board to use as a sublayer. Here is how the house is looking.

  • Subfloor Preparation

    Even though the floor has a definite slope, I figured I had to replace some bad boards in the subfloor. Here are the boards I’ve replaced so far. I probably need to do one more, but I think I’ll use a 1″x8″ instead of a 1″x6″, since there’s a bigger hole to fill.

  • The Work is Slow

    I spent the days working on the house. Made a big mistake, but learned a valuable lesson.

  • Happy Birthday Aunt Lu!

    My Aunt Lucille celebrated her 81st birthday just before the new year. Happy birthday to her!

  • The Idiot Returns

    While staying at my sister’s condo, I thought that her furnace seemed rather loud. In fact, it’s loud enough that it has woken me up a few times. I was thinking that maybe it was getting louder because the furnace filter needed to be changed. So, when it woke me up at 5am this morning, I decided to find out what size the filter was so I could buy a new one after work. Since it’s above the ceiling in the bathroom, I needed a ladder to reach it easily. There’s only a step stool here, so I was stretching quite a bit to try to get to it. I quickly saw that this was a size filter that I had never seen before. I figured it was roughly 12″x36″. I went to Home Depot after work, thinking there wouldn’t be many filters in that size and I’d notice it right away. Well, there were no filters in that size. Nothing remotely close. So, I got a tape measure and actually measured the filter when I got home. The size, 9 7/8″ x 39 3/4″. Basically, 10″x39″. Looked online and didn’t find anything remotely around that size. It looks like this was going to have to be custom made.

  • State of the Floor

    The floor is probably not going to be beautiful, but I think it’ll look ok. And I love the fact that I’m using the same wood that was in the floor. Stuff that had square nails in it when I pulled it out.

  • One Coat of Stain

    I finally decided that I was never going to get the floor perfect with sanding and that it was finally good enough. So today, I bought a can of stain and decided to just put it on to see what happens. I was going to just stain the one side of the floor that looked lighter, but then decided to do the whole thing. I didn’t really wipe any off on the lighter side of the floor, but did wipe off right away on the darker side. When I go back tomorrow, I’ll see how it turned out. If it’s ok, then I’ll put on the finish coat. If it’s not ok, I’ll probably also put on the finish coat because I have no idea how to fix this.

  • 2012 (and beyond) Goals

    Happy New Year!

  • Changing link_to to button_to

    In one of my rails apps, I send out email to a particular user. But, I can look at the message before it goes out. Then, at the bottom of this preview page is a link to actually send the message. I’m pretty sure that since this action is changing a boolean value on the user along with sending the email, that I should be using a button instead of a link. However, just switching the link_to to button_to won’t work because link_to uses a GET request, but button_to uses a POST request. So I need to change the button_to to use GET. The way to do that is like this:

  • Plans for 2012

    I’ve found that a little bit of planning helps me get much more accomplished than just trying to do things willy-nilly. I look back with great satisfaction at my decision to learn Ruby on Rails about three years ago. It took quite a bit of time and I’m not a guru yet, but I can and have created some websites that have been helpful. Since I had a personal day that I needed to use before the end of the year, I’ve taken it today and will use that to lay out my plans. And because I think that making the plans public will help me stick to them, I’ll post them as soon as they’re done.

  • Detaching Rails Processes

    In my latest app, I’m emailing reports to people who click on a link. (Yes, I know this should be a button, but I just did it with a link because it was easy. If I have time, I’ll change it to a button.) Anyway, I’m attempting to use Process.fork to do this. What I have that works is:

  • New DNS Registrar

    I finally had my fill of all the crap of Godaddy. Actually, that’s not quite true. That was a push, but the thing that really got me to switch is just the terrible website that one has to use to do anything with Godaddy. I found a new registrar Badger.com and decided on a whim to switch to them. I got one free credit (so I could transfer one domain for free) from Hacker News and I ended up buying two more for $8 each. I then started the process and was amazed to find that I had my three domains transferred in about 10 mintues. And they added an extra year to my domains. Their website is nice and clean. It’s easy to find stuff and they don’t try to sell me more crap each time I login. I can’t believe I waited this long to switch, but right now, I’m glad I did.

  • Rails Integration Tests

    After unit tests, for me, the important tests are integration tests. This is where I can test logging in and checking authorizations and calculations. They are a bit more involved, but not too difficult once you get the hang of them.

  • Rails Unit/Functional Tests

    In my latest rails project, I am trying to write good tests for everything important. My first tests were all unit tests. These are pretty easy. All they basically do is make sure that the data that’s stored in the database is formatted properly. So I have a bunch of tests that make sure that my validations are correct. A sample test looks like this: