18F/hhs-acf-uc-dashboard

View on GitHub
app/models/view/admin_new_user.rb

Summary

Maintainability
A
0 mins
Test Coverage
module View
  class AdminNewUser
    def initialize(user=nil)
      @model = user
    end

    def model
      @model ||= User.new
    end

    def role_names
      Role.all.map(&:name)
    end

    def role
      @model.role || default_role
    end

    def default_role
      'Operations'
    end

    def errors
      model.errors.full_messages.join('. ')
    end
  end
end