General

Ruby on Rails – Easy date displayNovember
19

I have created this simple format_date method to format dates differently and put it in the ApplicationHelper. I know it isn’t something that is a super WOW factor but thought I would share anyways.

  def format_date(type, date)
    case type
      when :short_no_year 
        date.strftime("%b %d")
      when :short
        date.strftime("%b %d, %y")
      when :long 
        date.strftime("%B %d, %Y")
      when :long_day_of_week
        date.strftime("%a %B %d, %Y")
      when :default
        date.strftime("%m.%d.%Y")
    end
  end

to call in your view just use

<%=format_date(:long, crappy_date_from_db) %>

Ruby on Rails – Easy NavigationNovember
19

This is primarily going to be a repost to some extent but would like to add a piece that I think will help even more. Based on http://www.cuberick.com/2010/05/simple-tabbed-navigation-in-rails.html I have added a simple regex that I think will help with the current status and be flexible to change on the fly if rules change.

<ul>
<li class="<%= selected_navigation(:items) %>"><%= link_to "Items", items_path %></li>
<li class="<%= selected_navigation(:things) %>"><%= link_to "Things", things_path %></li>
</ul>

and then add in the ApplicationHelper this simple code

  def selected_navigation(element)
    request.fullpath =~ /\/#{element.to_s}/ ? "current" : ""
  end

Welcome to Designwaves and Our Blog!June
6

Today is the big release of our new cutting-edge technology company, based in Raleigh, NC, that specializes in Website Design and Development, Social Media Integration, Cloud Solutions, eCommerce, and Content Management Systems (We provide a whole bunch of other exciting services too, but you’ll have to check out the site to get the full Overview). Although today is our big day, I’m sure more people are excited about the new iPhone release than ours… well actually we’re pretty fired up about the new iPhone too!

Our team will utilize the blog to provide new and exciting educational content of how-to’s, innovative information, and helpful hints and tips. I hope that you will find our Blog an excellent technical resource that will be an asset to your company or your technical needs.

Browse Archive