简体   繁体   中英

InvalidTextRepresentation: ERROR: invalid input syntax for integer: “all”

I know "all" isn't an integer

I took this method of the official documentation postgres + rails (I can't link it now but might later if needed)

def list
  @a = a.find(:all)
end

so I thought it would list every "a" in "a" table, but didn't. Instead that error was thrown. Isn't this the way rails+gres works? Help a newbie please, thank you vm

find accepts an integer and finds the record with the given int ID.

If you want to retrieve all records, use:

def list
  @a = A.all
end

Assuming that A is a model

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM