I am trying to create a private method that does some counting based on some database data as follows.
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception before_action :moderation_count private def moderation_count @count = ''; @count[:venues_pending] = Venue.where(:is_approved => 0).count.to_i @count[:venues_rejected] = Venue.where(:is_approved => 2).count.to_i @count[:venue_photos_pending] = VenuePhoto.where(:is_approved => 0).count.to_i @count[:venue_photos_rejected] = VenuePhoto.where(:is_approved => 2).count.to_i @count[:venue_reviews_pending] = VenueReview.where(:is_approved => 0).count.to_i @count[:venue_reviews_rejected] = VenueReview.where(:is_approved => 2).count.to_i end end
Error:
no implicit conversion of Symbol into Integer