Was that title a mouthful, or what!? Anyways, here is the problem I was trying to solve. I was wanting to write a query against my ActiveRecord model that finds an object where its email was like a search term. Well, here was my problem. Let’s say my object’s email was “TestUser@example.com”. If my search looked like this:
Then, if my search was “testuser”, it isn’t going to match anywhere with “TestUser@example.com” because of the upper case ‘T’ and ‘U’. So, what’s a boy to do? Well, here is what I did.
Drop a little “LOWER” in front of the property I’m searching against, duh! Now, this will be searching “testuser” against “testuser@example.com” and will find said user. Hopefully this will be useful for someone else.
This weekend, my wife and I went camping with the Fergusons. It just so happened that our home-town team, the Oklahoma City Thunder, had a playoff game that night. They were hoping to sweep the defending champs, the Dallas Mavericks, in their home stadium. Well, we are all pretty big Thunder fans, and we were sad that we were going to miss the game. Luckily, we got our hands on a radio, and brought it to the campsite.
The Thunder started the 4th quarter down by 13. Things weren’t looking good, and most people thought the Mavs would win at least one game at home, so we weren’t surprised by the situation. But out of nowhere, the Thunder rallied. Mainly by riding the hot hand of James Harden. But my favorite part was getting to listen to it on the radio.
There is something about a sports broadcast on the radio. Since there are no images to compliment what you are being told, you have to hang on every word. The silence that occurs between a jump shot, and its arrival at the basket, can be deafening. As we sat there, huddled around this small radio, we did exactly that. We were hanging on every word.
The Thunder slowly clawed their way back into the game. And as the final buzzer sounded, and we had swept the Mavs in the first round of the playoffs, we exchanged high-fives by moonlight. The coolest part were the echoes of cheers throughout the campgrounds, as Thunder fans crowded around the radios just like they would have before TVs and internet had ever existed.
I had already done quite a bit of work on my rails project when I figured out that Heroku uses PostgreSQL and not SQLite, which was the default when I created my project. Now, I’m sure I could’ve gone on my merry way, pushed the project up to Heroku, and ran my migrations. But, I felt better having everything running with the same database in the backend. And since I already had Postgres installed and running, I didn’t think it would be too hard. But, I decided to document it anyways, in case someone (myself 3 months from now) needed help.
The first thing you need to do is update your database.yml file. All you need to do is switch your adapter from sqlite3 (or whatever you are using) to postgresql. And update your database names. The format that seems most common is [app_name]_[environment] (ex. superproject_development).
Make sure you add a reference to pg in your gemfile.
Then you need to run the commands above in your terminal. And that’s it! Or, at least, that was it for me. Hopefully you don’t run into any extra roadblocks.
So, that picture above is not my actual x-ray, but you get the gist. Last Tuesday, I dislocated my shoulder playing indoor soccer. I was playing goalie, and dove to make a save. When I landed on my outstretched arm, it just popped right out there. I have been making saves like that forever, but for some reason, this one was the one. I spent the rest of the evening in the hospital, waiting for them to pop it back into place. I’m probably going to hang up my boots for a bit. Maybe take up running as a hobby again. Once my arm can move that is.
Yesterday I got stuck in a hairy situation while deploying to Heroku. For our deployments, we let Heroku precompile our assets, instead of doing it locally first. Yesterday, when it went to run that rake task, it failed, with this error
undefined method `[]’ for nil:NilClass
Awesome! What doe Heroku have to say on this subject?
There’s no fix or workaround at this time if assets:precompile is failing during slug compilation.
Perfect. Well, the error that I got told me there was a problem in my application.sass file. The problem was with this line
@import “jquery-ui”
That is referencing a plain css file, not a sass/scss file. My site had no problems compiling this file at runtime. And even when I tried to run the rake task to precompile everything locally first, it had no problems. So, it was something to do with that rake task running on Heroku.
The solution? I simply changed jquery-ui.css to jquery-ui.scss. Since scss is a superset of css, I didn’t have to change anything in the stylesheet, it just works. This solved the problem. Since I couldn’t find anything online about this, I decided to blog it out, to help out other people that are dumb like me!
Watched this video a couple of times last night. Absolutely blew my mind. I cannot fathom the farthest reaches of space. Makes me feel like a grain of sand.
Since last weeks game doesn’t have footage and we were run out of the building, let’s just pretend it didn’t happen, and we can focus on Monday’s game, sound good?
Fellas, we were close. We led for most of the game and even tried to come from behind late, but it wasn’t enough. But we still have Friday to look forward to.
There won’t be highlights on the blog just yet, but Mr. Doonkeen is working hard on creating a little something special. He swore on Cole’s first born son that is was going to be awesome. Since their aren’t video highlights, how about some verbal ones from yours truly.
insert cool background music
I’m sure that there were a ton more highlights, but we’ll let Ryan do work on those.
Are you kidding me!? Those were delicious. I’m on board for someone bringing apple slices to every single game for life.
This probably isn’t going to shock anyone, but this week’s Barracudos goes to Craig. He could’ve scored at least 3 or 4 more that he passed to someone else, to try and share the love. I’m not sure what the final tally was for him, 6-7 goals, but we were definitely glad to have him out there.
So Friday night is the last game of the season. And I don’t know about you guys, but I feel like we have gotten a little bit better each game, so I’m really looking forward to Friday. Since the game is on a Friday, we are trying to get a crowd out there, so tell your girlfriends/wives, parents, friends, whoever.
I know this season was rough on almost all of us, with the games being so late. But, we need to figure who is interested in playing next season. We are definitely dropping down to the lowest division, relegation style. And, I’m going to see what I can do about getting our games earlier, they said we just needed to ask, so I’ll try that move. So, no decisions have to be made right now, we can discuss it after the game on Friday. The next season starts October 3rd, so we would have a week off. I had a blasty blasty, and I’m definitely in.
Tough loss last week. The good news is, those guys were really awesome. We really shouldn’t be playing against teams of that caliber in the 2nd lowest division. And in other good news, we didn’t ever give up. We scored all 3 of our goals late in the 2nd half. And all of the goals were pretty sweet (more on that later).
We have a little more of the lowlights than the highlights this week. Mainly because we got completely destroyed, but also because the camera ran out of batteries before we scored all 3 goals. But, here is last week’s recap set to possibly popular music.
What I learned from the tape
And this week’s Barracudos goes to drumroll sound Steffen. After last week’s gaff, well, I believe Harry from Dumb & Dumber said it best. “Just when I thought you couldn’t possibly be any dumber, you go and do something like this… and totally redeem yourself!” This is Steffen’s 2nd 2-goal game, impressive. Steffen is also the first person to score on the landrun this season, slumpbuster. Job well done.
The team we play this week is in 1st place. So, they are apparently better than the other 2 teams that tore us apart. But that doesn’t mean we don’t have a shot. Maybe this scene from Little Giants will inspire you.
The game this week is on Thursday @ 11:50pm, so rest up.
I don’t know about you guys, but I really thought we had turned a corner. I was expecting it to be all wins from here on out. Probably got a little ahead of myself, right? The truth is, we aren’t far from being a decent team. We just need to keep tweaking things each week. Here is what I took away, after watching the game tape.
And the moment you’ve all been waiting for, this weeks highlights.
Favorite part, Cole dropping the jukie at the end and smoking that guy. You see the focus in his eyes!?
Thanks to Mr. Doonkeen’s brilliant and punny mind, we have a new way of recognizing an MVP each week. This week, Barracudos goes out to Kurtis. He scored 2 clutch goals that made the game level before we let it slip away right at the end. One of them was a nice header off of a completely accidental nice touch pass from Steffen. The other was off a rebound from a nice free kick from Corey. Job well done Kurtis.
A game before 10pm!? CHRISTMAS COMES EARLY THIS YEAR!! Seriously though, it looks like this should be a decent team this week. The game is at 9:55pm on Wednesday. Read over the bullet points above (mostly just about not playing zone) and we should have a good chance at winning.