For regular columns, you can get them using the method of the columns class. However, associations can be called completely different if the foreign_key parameter foreign_key specified in the relationship method. For example, given
class Post has_many :comments, :foreign_key => :message_id # this is a contrived example end
If I did Post.column_names , I could get message_id , but is there a way to get comments ?
reflection ruby activerecord
Matt Briggs Nov 13 2018-10-11 15:49
source share