ruby on rails - Retrieve only 'id' values from a Record Association -


i using ruby on rails 3.0.7 , have "user :has_many articles" record association retrieve user's articles in way:

@user.articles # => [#<article id: 1, title: "title 1">, #<article id: 2, title: "title 2">, #<article id: ..., title: "title ...">] 

however, need do, i retrieve article's id values association. btw: should more performant operation of above.

how possible in "direct" way? is, there ruby on rails method accomplish keeping unchanged :has_many association statement both involved models? if so, how?

http://guides.rubyonrails.org/association_basics.html#has_many-collection_singular

@user.article_ids 

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -