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.

Thanks,
Joe

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

1 Like