<commit_before>class Ability
  include CanCan::Ability

  def initialize(user)
    user ||= User.new

    if user.has_role? :admin
      can :manage, :all
    else
      can :read, :all
    end

    unless user.id.nil?
      can :vote, Poll
      can [:create, :update], Place
      can [:nominate, :add_options], Poll
    end

  end
end<commit_msg>Allow normal users to create polls, clean up abilities model<commit_after>class Ability
  include CanCan::Ability

  def initialize(user)
    user ||= User.new

    if user.has_role? :admin
      can :manage, :all
    else
      can :read, :all
    end

    unless user.id.nil?
      # Normal logged in users can...
      can [:create, :update], Place # create and update Places
      can [:create, :nominate, :add_options, :vote], Poll # Create, nominate and vote in Polls
    end

  end
end
{'fraction_non_alphanumeric': 0.09988109393579073, 'fraction_numerical': 0.0, 'mean_word_length': 2.5677966101694913, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7447302', 'n_tokens_mistral': 278, 'n_tokens_neox': 265, 'n_words': 92}