Fork me on GitHub

helper

    Not use time_ago_in_words

    10 Feb 2012

    Richard Huang (flyerhzm@gmail.com)

    It's very common for a rails developer to use time_ago_in_words to display time like "5 minutes ago", but it's too expensive to calculate the time in server side, you should utilize client cpu to calculate the time ago. Read More

    Tags 


    Remove empty helpers

    09 Apr 2011

    Richard Huang (flyerhzm@gmail.com)

    If you use rails generator to create scaffolds or controllers, it will also create some helpers, most of the helpers are useless, just remove them. Read More

    Tags 


    Substituting before_filter :load_object

    12 Oct 2010

    (mail@dennisbloete.de)

    Instead of loading an object with a before_filter you can use a more intelligent helper_method to get the main object for the controller context. Read More

    Tags 


    Generate polymorphic url

    23 Sep 2010

    Richard Huang (flyerhzm@gmail.com)

    If you want to generate different urls according to different objects, you should use the polymorphic_path/polymorphic_url to simplify the url generation. Read More

    Tags 


    Move code into helper

    24 Jul 2010

    Wen-Tien Chang (ihower@gmail.com)

    According to MVC architecture, there should not be logic codes in view, in this practice, I will introduce you to move codes into helper. Read More

    Tags