The undefined method message is because @articles
does not have an articles_type
method. You have to get to a single instance of an Article in order to use that method. You could do that with a call to @articles.first
or by iterating on the collection.
= @articles.first.articles_type.id
is the line you want to use.