Sha256: 550dce209901eeb1e3f44cb105b32229b2146e62658094cf662774d3c7abf060
Contents?: true
Size: 857 Bytes
Versions: 2
Compression:
Stored size: 857 Bytes
Contents
require 'sinatra/activerecord' require 'digest/md5' require 'sqlite3' require_relative 'time_ago' ENV_NAME = ENV['RACK_ENV'] || 'development' module Cachai class Comment < ActiveRecord::Base validates_presence_of :author_name, :author_name, :author_email, :content, :path def as_json(options = {}) { :id => id, :author_name => author_name, # :author_email => author_email, :author_img => author_img, :author_url => author_url, :content => content, :timestamp => created_at.to_i, # :created_at => created_at, :created_ago => Timeago.since(created_at) } end def author_img(size = 50) id = Digest::MD5::hexdigest(author_email.strip.downcase) "https://www.gravatar.com/avatar/#{id}.jpg?s=#{size}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cachai-0.0.2 | lib/comment.rb |
cachai-0.0.1 | lib/comment.rb |