Skinning your entire Rails app:
Say, a client wants to use my rails app, hosted on my server, but with the exact look and feel as their current site. I take thier CSS and HTML markup, and make it into a template to wrap around my app's content.
When I took to task to replicate that functionality in Ruby on Rails, I wasn't certain would be easily accomplished. All the tutorials I've read list template switching as purely CSS affairs. Using CSS to change the presentation of your site is a fine thing, but isn't enough if you are looking to completely copy the look and feel of a client's website with your app dropped in.
It took some thought and a little help from the community.
Previously, the system I was used to accepted a site variable passed with the login form that told which template to render. like http://myapp.com/?site=ibm
That's ugly and revealing, but what other way is there to know which template to render?
I recall setting up accounts at a handful of sites that were in the format of: http://myusername.myapp.com
This is known as using a subdomain as an account key. Luckily, there is a very simple plugin to set that up in Rails http://wiki.rubyonrails.org/rails/pages/HowToUseSubdomainsAsAccountKeys
After setting up the plugin, I'm able to access the subdomain name anywhere in the app. Good thing, because I need to access it in application.rhtml (or .haml)
<% # if there's a subdomain, render the partial of the same name -%> <% if account_subdomain -%> <% # first check to make sure account_subdomain is valid and in accounts table -%> <% @account = Account.find_by_username(account_subdomain) -%> <% unless @account.nil? -%> <%= render :partial => "layouts/"+account_subdomain %> <% else -%> <% # There's a subdomain, but it isn't valid. Render default template -%> <%= render :partial => "layouts/default" %> <% end -%> <% else -%> <%= render :partial => "layouts/default" %> <% end -%>
Notice in the above, that there are no :yield statements. That's because :yield can live in a partial too. I've set up a partial for each subdomain listed in my database in app/views/layouts, and added some logic to render the default layout when a subdomain either isn't present or is invalid.
If you have any questions or comments, please drop me a line.
I'm still here. :
If you have been trying to email me, my mail server suffered a disc failure, I'm still in the process of gettting things set up again.
If you want to concact me in the meantime, send your email to email@example.com
things are working fine now, you can email me through the usual addresses again.
I'm still here. :
My wife's stepdad got his tax check and handed over $1400 to me to build him "The best gaming computer you can get with this, minus a little for yourself".
He plays only one game in the seven years I've known him....Delta Force
Thus was born:
Project: :Delta Force:
A high-speed, suprise computer case modification.
Check it out and read about its construction HERE.
I'm still here. :
I have gotten very lazy with the upkeep of this site in the past year, but the rush of visitors to see my ipod do-hickey's and case modding have inspired me to crack down and keep the content flowing.
I have finished a new case project, which I will soon post as soon as I get my pictures sorted. I also have been test implementing a gallery function for showing off masses of pictures, for those that just aren't interested in my actual content. I've restarted work on Project: MACSE, and as always am tweaking my HTPC.
The new light of my life. :
I know its been a very long time since I have posted a new creation to this site, but I've got a pretty good one to share with you all today (albeit a bit late, as this one has been done for 6 weeks now).
Meet my daughter, Caedence Rain Jones.
I'll try and elaborate later, and update this post with a gallery of pictures to placate my family and friends.
Home Made iPod Battery Packs. :
I go camping for extended periods of time in places with no electricity, and I had checked out getting the Belkin Battery Pack for my iPod, so I could always pack extra batteries and rock it out for a week or more away from civilization, but the price turned me off quickly.
Belkin charges close to $70 for these pieces of plastic! All it is, is 4 AA batteries in series connected to a short version of the Apple iPod Dock Connector.
I said to myself (and probably a few other people); Hell, I can do that myself cheaper and with less batteries.
A little planning and ordering of a handful of parts, I set to work to create my own version of the iPod Battery Pack.
If you want to see the details of the creation, click Here.
That time again, here a list of stuff to buy for me. :
My Mom-in-Law asked me to publish a wish list for Stacey and I's birthdays (Nov 18th and 30th) and Christmas on my site, so here it is. I'll be updating it as we think of things.
Got Slashdotted & Sued in less than 5 hours. :
I've been waiting for the situation to cool down a bit, but last month, I spent a lot of time working with a few others trying to figure out the way Apple tried to determine if an ipod is American or European.
The goal was to "convert" a European ipod to an American ipod, because American ipod's aren't volume limited to 75% or so like their European Counterparts.
I won't go into details at this time, but the day we thought we had it figured out, one of the others submitted his version of my guide to apple.slashdot.org,
and of course I was emailed a 'cease and desist' from Apple's legal department because I was distributing a "dd" image of the American ipod's firmware.
I immediately complied, and removed both the firmware images and the instructions. A lawsuit over something so stupid is something I would like to avoid. However, we began again trying to find a legal way to convert the ipod. More details later, but I wanted to get this on the front page eventually.
The old switcharoo. :
I ordered a DLO Podfolio case for my iPod, and what I got isn't exactly what I expected.
Innovation through boredom. :
I love my new 30 gig iPod.
Check out how I rigged it into my car with a $5.99 cellphone holder HERE.
RC5 is more than a crypto system, its a state of mind :
I went to Rubi-Con 5 a few weeks ago, and I had a great time, and apparently blake did too.
Read about my experience HERE
ITS MILLER TIME AGAIN!!! :
Its about time...I've had my birthday, and I've wed my wife. The weather is warming up, and I'm starting to move around a bit more like normal.
My life is coming back on track.
With that, comes my first update of the year.
My teenage years were ill-spent writing comics making fun of the teachers and the students I knew best. Mr. Miller was a special teacher of a manufacturing related prep course called FAMS, and Mr. Maunu was my 11th grade geometry teacher, both of them had strange superhero-like powers to bore me into writing these comics.
Millerman!, and MepMan! team up in this episode to battle the evil Mr. (Don) Griffon, the devious economics teacher.
Follow the adventures of this unlikely duo in Episode #2 of Millerman!
Click here for Episode #2
Click here to start at the beginning
My Birthday is coming up. :
Although I generally don't like to make up Christmas/Birthday lists, here it is:
Hint: Christmas is Dec 25, my Birthday is Nov 30, and my Wedding is Feb 14
A snowball fight broke out in hell this weekend... :
On Friday, NVidia released Accelerated OpenGL drivers for its line of video cards on the FreeBSD Operating System.
Up until this weekend, just about the only other card supported for Accelerated Graphics is the (now defunct) 3dfx Voodoo3, and just about the only game supported was Quake3.
This release brings tons of useful and fun software to BSD, including Blender and a whole host of games that have been ported to Linux. This is because FreeBSD can natively run Linux binaries.
I myself love BSD, and this is exactly the thing it was missing to be on my main desktop. I plan on installing these within the week.
Get yours at NVidia's website HERE
Victoria's Secret now sells Freudian Slips :
Normally, I don't follow entertainment news, but someone showed me this clip of a news reporter making just about the funniest Freudian slip while talking about Jennifer Lopez.
Check it out HERE
The most disturbing thing, I think, is the part about the "curbjob", which is where you make someone bite down on the curb and stomp on thier head, like in the movie American History X.
ITS MILLER TIME! :
Continuing with the internet debut of my angst-ridden satirical comic series, I created a superhero-themed comic featuring my favorite high-school teachers newly-endowed with super powers!
This is among my best works, and I hope you like them even 1/10 as much as I did.
I present, MILLERMAN!!
LINKING FOR JESUS!! HALLELUGHA! :
My good friend Wil is running an ad-campaign in a most unusual fashion.
In other words, he is having his own Awful Link Of The Day.
I noticed he left my link in his "Linking For Jesus" campaign, I can only wonder if he intends to rip my site apart. Here's hoping.
Anyway, I felt bad, because one of his conditions is that the site being made fun of in turn, link back to his pathetic Anthrax for the eyes, lobotomy of a php guide for dummies(R), website.
SO HERE'S YOUR DAMN PITY LINK ----> www.SITE73.com
My heart is filled with pride.
Tales from the Dorkside, Part 2. :
I've updated my comics section with 6 new comics,
If you haven't read 1-6, then click HERE.
If you already have, then you can start HERE
Tales from the Dorkside. :
Sometime in the dark depth of my life I call "High School" I whiled away the time I should have been working, or pondering the great questions of life, by drawing.
I drew up comics that would belittle and demean the teachers and the institution that gave them all jobs.
It started as a way to vent some frustrations associated with being a student of possibly the worst high school in the Midwest.
Later, it became a vehicle for my strange and skewed sense of humor.
I have to give a lot of thanks to Jason Walker, who had been doing comics slightly longer than I had, and gave me the inspiration for many of the comics you are about to see.
Please try not to be offended by the earlier comics...my style of criticism started crudely, but with time and practice, I believe it had matured a lot. And I must state formally that I have nothing against Mexicans, as may be inferred from some of the storylines. Berto was my friend, and we only teased him about it in good fun.
Enough rambling...on with the comics!
I present, ARLINGTON TALES
Wil Wheaton-esque Blog Garbage Update. :
Well, I've finally made my last trip to my old home, to get the last of my things and to say goodbye to many good friends. I will return every few weeks to see what is going on, but it just won't be the same.
Too all my good friends, you know who you are, I won't forget you. And I WILL visit. No one seems to believe me when I say that.
I now live on the NorthEast side of Indianapolis, and am working again with the family printing company. I got offered another job today, but I accidentally hit *delete* instead of *save* on my voicemail message system. If you were the one who called me....I'd like you to call me again or email me.
SBC/Ameritech finally sent me a DSL modem, Turns out their service is PPPoE, and they only provide a username/password setup software for Windows and Macs.
Good thing my Stereo runs Windows (The only thing in the house!), and after it was all set up, I had to tackle with RP-PPPoE. But I've got it all working now with my network.
I'm still way behind on relaxation time...Hopefully this weekend will do the trick. Look for more work (and updates) soon. Sorry for this BLOG-like update, but I just wanted you to know before you start deleting your bookmark here.
Better Living thorough Watercooling. :
Sorry about the lack of updates...I still don't have Internet access in my new home. Should be getting DSL by the end of the week.
I've been trying to finish this article for quite awhile...but since I'm not making any progress (right now anyway), I'm going to post it anyway.
My Adventures in Watercooling my Computer's Power Supply
I will have much more coming soon, I promise.