aboutsummaryrefslogtreecommitdiff
path: root/interfaces/ruby/models/post.rb
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-03-03 14:36:03 +0100
committerJohn Ankarström <john@ankarstrom.se>2021-03-03 14:36:03 +0100
commit27067b4d8e5e854f16e3bdb08c2f63f4250632a8 (patch)
tree3221635a1fda3604da02548debfab19b96ddd50c /interfaces/ruby/models/post.rb
parentd40c681d2f9d56e01cd5f1ff3e586b79ea4397f9 (diff)
downloadcomb-27067b4d8e5e854f16e3bdb08c2f63f4250632a8.tar.gz
Add 'url' field to config table
Diffstat (limited to 'interfaces/ruby/models/post.rb')
-rw-r--r--interfaces/ruby/models/post.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/interfaces/ruby/models/post.rb b/interfaces/ruby/models/post.rb
index 3a29a1c..28cc82c 100644
--- a/interfaces/ruby/models/post.rb
+++ b/interfaces/ruby/models/post.rb
@@ -6,6 +6,10 @@ class Post < ActiveRecord::Base
validates_presence_of :slug
validates_presence_of :title
validates_presence_of :body
+
+ def url
+ "#{$config.url}/#{created_at.strftime("%Y/%m/%d")}/#{slug}"
+ end
end
class CreatePostTable < ActiveRecord::Migration[6.0]