Reputation: 61
When i written my poll app i was get an error:
http://screenshot.sh/m3eeke1da49kL
So I tried to comment code and inspected value. http://screenshot.sh/mGR8cOuGizBRx
Why i can't access the values? There is a code of helper method:
def poll_option(poll)
@option = VoteOption.find_by(poll_id: poll.id)
content_tag :div, class: 'form-group' do
content_tag(:label) do
unless current_user.voted_for?(poll)
radio_button_tag 'vote_option[id]', @option.id
end
@option.title
end
visualize_votes_for @option
end
@option.inspect
end
Upvotes: 1
Views: 39
Reputation: 61
ok i resolved the problem but the code
def poll_option(poll)
@option = VoteOption.find_by(poll_id: poll.id)
@option.each do |o|
content_tag :div, class: 'form-group' do
content_tag(:label) do
unless current_user.voted_for?(poll)
radio_button_tag 'vote_option[id]', o.id
end
o.title
end
visualize_votes_for o
end
end
end Gives an error that "each" is undefined method.
Upvotes: 1