Error: private method `select' called for nil:NilClass