Ruby

Tabbed Interface – A new rails plugin

It’s not like we really need a new rails plugin, but this one I really saw the need for. Tabbed interfaces can really improve how your website looks and flows. Here’s a great article from smashingmagazine about how, when and why to use tabbed interfaces. Here’s a quick rundown of the plugin. Let me know what you think!

TabbedInterface

Build a tabbed interface very easily. Requires Prototype.

see a working example at http://tab-interface.heroku.com Install

./script/plugin install git://github.com/jondruse/tabbed_interface.git

Move the ajax-loader.gif from the resources folder to your public images folder, or go make one at http://www.ajaxload.info/. Whatever you do, just make sure you call it ajax-loader.gif.

An example More >

Leveraging the power of inheritance in Rails.

Here’s a neat trick.  It’s pretty simple but really helpful.

Problem: You’re always setting up the same stuff in every controller. Layouts, helper methods and so on.

Solution: Set up your own controller to inherit from.

Throw this into a new file in the controllers folder called base_controller.rb.

class BaseController < ApplicationController     layout "base"   helper :my_cool_helper   end

Now take any controller and change the first line like below. Now anything in BaseController you get for free. So in the example below, PostsController’s layout will be “base” and will have the MyCoolHelper included also.

class PostsController < BaseController   def list   end end

Wow, that was easy. Now it’s More >