以前の号では、次のコードが期待どおりに機能しているように見えることになりました。
def my_squeel_query
table_name = Squeel::Nodes::Stub.new("#{self.class.to_s.tableize}_comment_associations".to_sym)
commenters.
.where{
table_name.article_id.eq(my{self.id})
}
end
変数article_id
に対して行われたのと同じくらい動的なステートメントを作成することは可能ですか?table_name
つまり、次のようなものを作りたいと思います。
def my_squeel_query
table_name = Squeel::Nodes::Stub.new("#{self.class.to_s.tableize}_comment_associations".to_sym)
commenters.
.where{
table_name.<DYNAMIC_KEY>.eq(my{self.id}) # '<DYNAMIC_KEY>' refers to a column name present in the 'commenters' database table.
}
end