I decided that in the spirit of Rails that i’d list all the helpers that I have created. Use them in any of your work (commercial included), don’t sell them on though. A hat tip may be nice.

Layout & Templates


# If you set @page_title in the controller, it'll appear as a sub page in the header
# Wrap this in
def page_title
@page_title ? “LT3media » #{@page_title}” : “LT3media”
end

Date / Time


# Usage: in_the_future?(3.days.from_now) #=> true
def in_the_future?(to_time)
Time.now.to_date < to_time
end


# Usage: in_the_past?(3.days.ago) #=> true
def in_the_past?(from_time)
Time.now.to_date > to_time
end

Object Extensions


# Usage: @variable.exists? #=> true
class Object
def exists?
!self.nil?
end
end

View Extensions


# Put this in your layout file
<% flash.each do |key, message| %>