Skip to content

Instantly share code, notes, and snippets.

@batasrki
Created September 25, 2011 22:47
Show Gist options
  • Select an option

  • Save batasrki/1241278 to your computer and use it in GitHub Desktop.

Select an option

Save batasrki/1241278 to your computer and use it in GitHub Desktop.
Example model display method
class Job < ActiveRecord::Base
def display_name
I18n.t("web-app-theme.job", :default => "Job")+"#: "+leading_zeros(self.id, 5)+" / "+self.category.name+" : "+self.name
end
def display_shortname
if self.name
self.name+"("+self.category.name+")"
else
I18n.t("web-app-theme.job", :default => "Job")+"#: "+leading_zeros(self.id, 5)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment