Showing posts with label Rails. Show all posts
Showing posts with label Rails. Show all posts

Friday, June 20, 2008

Nested Layouts in Rails


I was wondering how to keep the layouts in my rails application code DRY - I was close to the point of kicking myself for having to make changes to all my layouts whenever something standard changed - so i researched online and found the above diagram by Matt McCray in his blog.

I used Matt's method for nesting layouts, but instead of defining a method called sub_layout in my controllers, I called a pre-defined rails controller method:

<% render :partial => "layouts/#{controller.controller_name}" %>

and defined a partial layout named after every controller I had, which had different settings for their own views. Rails has a local variable called 'controller' you can use to access its controller's name and even the action used for the current view. So using this, I don't have to define additional methods in my controllers, nor use any plugins.

kudos to Matt for coming up with this in the first place. Thanks!

Wednesday, May 28, 2008

Rails training, anyone?

I got a little lazy (well, a lot really... ) so i decided that i didn't want to study Rails by reading, but by watching a video with a popcorn in hand (really hard to get good popcorn these days)

searching through the web for video tutorials, I came across this set of videos from guys at UC Berkeley RAD Lab... Never been to UCB, but I hear its a beaut... my kudos to the guys at UCB RAD...

the video filesizes are large... I nodded off waiting for it to stream... so you might wanna have a firefox extension do the downloading for you before you view them... here's one. If you're using IE... again, seriously?

anywho, check it out! i think it's RAD! haha! (although i haven't even gotten to the end of one yet, so no guarantees)

we'll post some video tutorials up in the future - when we actually have time to kill... but we will... promise...

Sunday, May 11, 2008

Ruby Cheatsheet Part Two!

Finally, part 2 of the Ruby Cheatsheet is now complete! Click here to download the file from Scribd, which, by the way, is also an excellent site for lots of stuff... so kudos to the Scribd crew...

Part two gets you acquainted with the built-in stuff ruby provides to make your coding life easier and more fun (or confusing maybe?). Great help for you young apprentices who are looking forward to becoming Jedi Railers... (Nothing like geek speak to lighten up your day)

Now, about that project wall....

UPDATE: The combined version, part 1 and part 2 together, can be found here. I've made some improvements to the file to make it more readable - Acap