undefined method `table_name' for #<Arel::Table:0x00000001140940b0 @name="posts", @klass=Post(id: integer, title: string, content: text, created_at: datetime, updated_at: datetime, location_name: string, address: string, image: string, user_id: integer), @type_caster=#<ActiveRecord::TypeCaster::Map:0x0000000112ebbf28 @klass=Post(id: integer, title: string, content: text, created_at: datetime, updated_at: datetime, location_name: string, address: string, image: string, user_id: integer)>, @table_alias=nil>
Did you mean?
  • table_alias
Extracted source (around line #3):
1 2 3 4 5 6 | class PostsController < ApplicationController def index @q = Post.ransack(params[:q]) @posts = @q.result(distinct: true).includes(:user, :comments).order(created_at: :desc).page(params[:page]) end -- | --