Error: undefined method `to_sym' for nil:NilClass