I tried with considerable effort this weekend to get a 100-inch couch up to my new third-story studio space. This while I was trying to pass a 5mm kidney stone, stubbornly lodged in my ureter just below my left kidney. Both efforts have been a fail. I turned next to mydumbwebsite (no, not his august blog) in the vain hope that I could at least get something done this weekend. It's a Ruby on Rails app. It's made up of "quote" -- rails, which is an allusion to railroad ties and suggests a journey comprised of routes. I've had some trouble with routes this weekend. My Rails app wasn't going to give me a pass on this state of malaise.
I figured out that the first place Rails looks for your home page is in a public directory, auspiciously named public. When you create your Rails app, this file is automatically generated as a smoke test. Your job is to delete it though, and send Rails to the next place of reference. I thought this would be in the app/views/home directory since I went to the trouble to create a home controller, but nope. It first goes to app/views/layouts/application.html.erb. This file is also automatically generated and serves as a filter to all your page views (by views, I mean pages more or less, but views is the idiom here).
So with a little tinkering in the general-purpose application.html.erb and some very basic manipulations on my index.html.erb file, I was hoping that typing in www.localhost:3000/ would yield what was typed in my index.html.erb file. Well, not really. It appears there is another file called routes.rb that needs explicit instructions to route root calls to a specific file. This is done quite simply by typing the following into the file: root :to => "home#index".
A now it works, except I thought I'd get a little cutting-edge and start deploying haml over the bellicose HTML format. This got me a bit confused but only for a short while. I now have application.haml and index.haml proudly adorning the cornerstones of my application. I had to dispense of the old .html.erb files first for it to work and did this by simply renaming them .html.erb.old where they now sit in a sort of death-bed way, like they know it's only a matter of time.
I figured after this was done, that it was high time I created my own CSS style sheet. First I needed to find out what that actually is and what it does. Well, it's quite simple really. It's a library of settings for your HTML tags. I created and placed a file called cheese.css in the public/stylesheets directory thinking a call to stylesheet_link_tag would access it no problem. Well, of course there was a problem. I googled the error message and went on irc for an answer. I was able to figure what was not the problem, but my solution was the result of fiddling around with wild-guessing solutions. I created a directory named stinky in the public/stylesheets directory and placed the cheese.css file there. And now it works. I've got some of my routing issues resolved.
Now I just need to sit on my mis-placed couch and pass a stubborn stone.
0 comments:
Post a Comment