ошибка
SQLite3::SQLException: no such column: taggings.tag_id: SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."post_id" = ?
Extracted source (around line #11):
9
10 def all_tags
11 self.tags.map(&:name.to_proc).join(', ')
12 end
13
14 def all_tags=(names)
/post_controller.rb
def post_params
params.require(:post).permit(:title, :summary, :body, :image, :all_tags)
end
/_form.html.erb
<div class="form-group">
<%= f.label :all_tags %>
<%= f.text_field :all_tags, class: 'form-control' %>
</div>
/tag.rb
class Tag < ApplicationRecord
has_many :taggings
has_many :posts, through: :taggings
def self.counts
self.select("name, count(taggings.tag_id) as count").joins(:taggings).group("name, taggings.tag_id")
end
end
/tagging.rb
class Tagging < ApplicationRecord
belongs_to :post
belongs_to :tag
end