Need a value from the db, not sure how to get it

I have a table called poll_options, and the column ‘count’

I need the sum of that for a specific poll id.

Not quite sure how to get that.


PollOption.sum(:count).where(poll_id: ‘123abc’)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs