Sha256: 766ebc7a97ac0e300dcde03f5d01656b50ba0886810a773a01b76111657d7e14
Contents?: true
Size: 671 Bytes
Versions: 1
Compression:
Stored size: 671 Bytes
Contents
module Transit module Helpers module ModelHelpers extend ActiveSupport::Concern included do field :uid, :type => Integer # Increment the sql_id each time to have a sql (auto_increment) style id for each post. before_create :generate_uid, :on => :create end def generate_uid return true unless self.uid.nil? ref = self.class.collection.name.singularize.classify.constantize self.uid = ref.max(:uid).to_i + 1 end def timestamp return "" if self.created_at.nil? self.created_at.strftime("%B %d, %Y") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
transit-0.0.1 | lib/transit/helpers/model_helpers.rb |