Sha256: d77bb49caac5ea5939cace0d8ac460af7d7e444c27b69063bff13981cdd92654

Contents?: true

Size: 280 Bytes

Versions: 12

Compression:

Stored size: 280 Bytes

Contents

class Post < ApplicationRecord
  # belongs_to :author, class_name: 'User', foreign_key: :user_id
  belongs_to :user
  belongs_to :category

  # tutorial: https://youtu.be/WgNK-oINFww?t=209
  def excerpt
    ActionView::Base.full_sanitizer.sanitize(content).truncate(50)
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rails_app_generator-0.3.6 after_templates/addons/avo/app/models/post.rb
rails_app_generator-0.3.5 after_templates/addons/avo/app/models/post.rb
rails_app_generator-0.3.4 after_templates/addons/avo/app/models/post.rb
rails_app_generator-0.3.3 after_templates/addons/avo/app/models/post.rb
rails_app_generator-0.3.2 after_templates/addons/avo/app/models/post.rb
rails_app_generator-0.3.1 after_templates/addons/avo/app/models/post.rb
rails_app_generator-0.3.0 after_templates/addons/avo/app/models/post.rb
rails_app_generator-0.2.43 after_templates/addons/avo/app/models/post.rb
rails_app_generator-0.2.42 after_templates/addons/avo/app/models/post.rb
rails_app_generator-0.2.41 after_templates/addons/avo/app/models/post.rb
rails_app_generator-0.2.40 after_templates/addons/avo/app/models/post.rb
rails_app_generator-0.2.39 after_templates/addons/avo/app/models/post.rb