Using the following code in my controller, I can extract all the rows from my table, but not sort by last_name column. Any suggestions?
last_name
@pi_names = PiName.all(:order => 'pi_names.last_name DESC')
Try
@pi_names = PiName.order('pi_names.last_name DESC').all
Alternative syntax to detect potential errors before runtime:
@pi_names = PiName.order(last_name: :desc)
Source: https://habr.com/ru/post/894663/More articles:Very slow subqueries when using "NOT IN" - ms-accessto create a drilldown menu - jqueryDetect window resizing and execute function using jquery - javascriptCan I set the optimization level for RhinoScriptEngine in Java 6? - javaCreating entity rules - javaClose child dialogs when closing parent - c #Convert database to CSV and save file to folder on server - phpHow to fully launch WinForm interface upon activation - c #Printf () before the line causing the segmentation error fails - cHow to remove space at the bottom of matplotlib chart? - pythonAll Articles