Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read
Q&A

Post History

50%
+0 −0
Q&A How to fetch single column for children?

1 answer  ·  posted 1y ago by deleted user  ·  last activity 1y ago by luap42‭

#1: Initial revision by (deleted user) · 2021-08-28T15:48:40Z (over 1 year ago)
How to fetch single column for children?
How to get specific children's column? For questions, I can use `@post.last_edited_at` or, something just like this. But, I was thinking to fetch a single column for all child. 

```ruby
<% post.children.last_edited_at do |last_edited| %>
  <span>last_edited</span>
<% end %>
```

But, this isn't correct way to fetch single column for all child. I can fetch child's all column but, not a single one. I was thinking to put those strings inside an array. But, there's no possible way to put those value in array either. If I split using `"` than, what if user is using quotation mark in body.
```ruby
<% children.each do |answer| %>
```

I can fetch all columns above way but.... 

I am working on post.rb models.