0
---
- !ruby/object:Comment
attributes:
post_id: '5'
changed_attributes: {}
previously_changed: {}
attributes_cache: {}
marked_for_destruction: false
destroyed: false
readonly: false
new_record: false
- !ruby/object:Comment
attributes:
post_id: '6'
changed_attributes: {}
previously_changed: {}
attributes_cache: {}
marked_for_destruction: false
destroyed: false
readonly: false
new_record: false
- !ruby/object:Comment
attributes:
post_id: '3'
changed_attributes: {}
previously_changed: {}
attributes_cache: {}
marked_for_destruction: false
destroyed: false
readonly: false
new_record: false
- !ruby/object:Comment
attributes:
post_id: '7'
changed_attributes: {}
previously_changed: {}
attributes_cache: {}
marked_for_destruction: false
destroyed: false
readonly: false
new_record: false
- !ruby/object:Comment
attributes:
post_id: '1'
changed_attributes: {}
previously_changed: {}
attributes_cache: {}
marked_for_destruction: false
destroyed: false
readonly: false
new_record: false
(http://pastebin.com/J1angM6d)オブジェクトから値を抽出するにはどうすればよいですか?
どのように私は配列としてpost_id
の値を得ることができますか? @arr = [ 5,6,3,7,1 ]
これでこの投稿を取得したいと考えていますpost_id
これが正しいですか? @p = Post.where(:id=>@arr)
に-1 – corroded
しかしこれが正しいかどうかを尋ねる必要はありませんが、あなたは、単にそれを試みることによって自分自身に答えることができる質問です。あなたは私たちに教えてください、それは動作しますか?それはあなたがしたいことをしていますか?あなたがそれを試してもうまくいかなかった場合、あなたは人を打つためにはるかに良い質問があります。 Thiloも言っているように、あなたの質問に誰かが返信する前に、回答を受け入れる必要があります。 –
@corroded私ではない:) – Thilo