Ruby on Rails having problems with table column names

Jun 15, 2006  -  Comments

I was working on a project for work today that invloved the client be able to enter customer testimonials into a database to be displayed randomly on each site page. I named the table quotes and it had three columns: id, person, and quote. I made id an integer and quote and person were both varchars. Everything worked fine with this configuration.

After some testing, I discovered that a varchar wasn't the best type for the quote because it didn't have enough room for the longer testimonials. Like a good Rails developer, I wrote a migration script to change the quote column to be text instead of varchar. Well, after making this change, Rails bombed every time I tried to add another quote. For some reason, it didn't like the column to be of type text and have the same name as the Rails table object. I'm not exactly sure what or why specifically caused this problem, but it definitely didn't work. After some consultation with The Shawnami, the resident Rails guru, and some extensive frustration, we finally decided to try and just rename the column. Guess what? It worked perfectly after I renamed it content.

Tagged: railsdb

Safari line height problem

Jun 14, 2006  -  Comments

It seems like I've been stuck on the line-height property lately. Well, today I noticed Safari giving weird behavior with regards to line-height. In the CSS documents we create at work, we always include a standard set of entity styles at the top and then go back and edit them if needed. Well, in that standard set is where we define the font-size, line-height, padding, etc. for our most-used html tags. I ran into a problem today where Safari was effectively ignoring the previously declared line-height property when I redefined the font-size of an element. So, to fix this, I had to re-define the exact same line-height(in percentage) for the new font-size.

I'm a huge fan of the Mac (I use one at work), but Safari can cause some headaches (nowhere near IE, though).

Tagged: safaricssxhtml

IE giving small divs a minimum height

Jun 12, 2006  -  Comments

I ran into a funny problem recently. I had to build an odd layout for a new website at work that involved text following a bending curve. Well, I just gave different padding to each of the <p> tags to accomplish the flowing effect. There were also divider lines between each paragraph that were shorter horizontally than the paragraphs. So, to get around this, I figured I could just create a div with a set width, a height of 2px, and a border-bottom. Of course, this worked fine in all browsers. . . except IE.

For some reason, the div in IE defaulted to a height of around 10px. This was very odd seeing as how I specified a height of 2px in the CSS. Well, after some playing around and a little Google-ing I figured out the problem. Apparently, IE will override the height property if the line-height is greater than the height. So, to get around this little problem, simply set your line-height to a value equal to or less than the desired height of the div.

Here is my code:

.line {
   width: 218px;
   height: 2px;
   line-height: 1px;
   border-bottom: 1px solid #CED9DF;

Update: After some more research into the problem, it turns out that IE 6 thinks the height of your div is only as small as your font-size. So, instead of setting your line-height to zero or a small number, set your font-size, like so:

.line {
   width: 218px;
   height: 2px;
   font-size: 0;
   border-bottom: 1px solid #CED9DF;

Tagged: ie suckscssxhtml


May 28, 2006  -  Comments

The blog is now live! I wrote this to get some practice with Ruby on Rails. The whole process was suprisingly easy. Rails does almost all of the work, so it only took me about two weeks to get the whole thing built in my spare time. Even a chunk of that time was spent designing the layout. I'm not very creative, so I had to look at a lot of other blogs before I could get enough ideas to rip off.

To fill it out a little bit, I've copied over around 12 posts from an old LiveJournal that I used last year when I was in France for two months.

Tagged: rails

Home at Last

Feb 20, 2005  -  Comments

Yesterday was my flight back to the US. And of course, it wouldn't be a true international flight for me unless at least seven things went wrong. I started the morning in Beauvais, a small town about an hour north of Paris. We were there because Lauren was flying to Scotland to visit her cousin and her flight left from the airport there instead of in Paris. Also, her flight left really early in the morning, so we spent the night there to make it easier. Well, after she left, I had to take a taxi to the train station in Beauvais. I got out pretty easy because someone else from the hotel had to go the the station too, so we split the cost of the cab. Once I got there, catching my train to Paris was no problem. We even arrived on time. Even in Paris things went smoothly. I caught the train to the airport, no problem. I got to the airport in time, checked in, and at the proper time I boarded the plane.

"Wow," I thought as I sat on the plane waiting to take off, "this is actually going pretty well for once." Of course, that's where everything fell apart. The captain informed us that the hydraulic lift used to load our baggage onto the airplane had broken. Our bags got loaded fine, but they couldn't get the machine away from the plane for us to take off. Well, after about half an hour they fixed it and we took off. The captain assured us we would still land at the scheduled time. Naturally, that didn't happen. We were about 20 minutes late landing. Because our flight had come from France, my luggage didn't automatically get forwarded to my connecting flight. I had to go to the baggage claim, get my luggage, go through customs, then re-check my bags. Keep in mind that because of our delayed take-off I had exactly a one-hour window before my connecting flight left.

So, I go to the baggage claim area and wait patiently. After at least 30 minutes of waiting, the bags finally start to appear. None of them are mine. I keep looking at my watch nervously. I have 20 minutes before my flight leaves, still no bags. I have 15 minutes before my flight leaves, still no bags. I decide "screw it," I'd rather be home than have my bags. I take off running through the airport. I assumed that the gate for my connecting flight will be nearby and 15 minutes will be ample time to make it there. Wrong again. It's all the way across the airport. I ran non-stop until I reached the gate. . . . . . . . five minutes after the plane had left.

By this time, I just want it all to end. I go back to the American Airlines ticket counter and they get me booked on a Delta flight to Atlanta that leaves in an hour. I go check-in with Delta. "I may actually get home tonight," I say to myself. I proceed through the Delta security check. I guess because I haven't had a haircut in a few months and haven't shaved in a week, they think I look like some kind of security threat. I get the full work-up. They thoroughly go through each of my bags. They pat me down, wave the metal detector over every inch of my body, make me take off my shoes, take off my belt, and empty my pockets. Despite this lengthy delay, I still get to the gate on time to board the plane. On the entire airplane, there were maybe 20 other people besides me.

I get to Atlanta on time and my mom is there to meet me. If you recall though, my luggage is still in Chicago because I didn't have time to claim it. So, I have to go to the other side of the airport once I arrive to file a missing bag report with American. Once there, they tell me that since Delta brought me to Atlanta, they have to find my bags for me, even though American is in possession of them. So, I walk back to the other side of the airport and file the claim with Delta. To their benefit, they were a lot more efficient than American. Where it took more than a week for American to return my lost bags in France, Delta had them back to me today (less than 24 hours).

It's good to finally be home.