pioz/ximate — Issue #3: Order by Rank not working -- ActiveRecord::StatementInvalid: OCIError: ORA-00904: "FIELD": invalid identifier: 
Author: frugardc
Created: 2011-11-04 18:12:12+00:00
State: open

Order by Rank not working

Geocode.asearch("111 Eighth Ave").order('rank DESC')

ActiveRecord::StatementInvalid: OCIError: ORA-00904: "FIELD": invalid identifier: SELECT "LOCATIONS".* FROM "LOCATIONS" WHERE (locations.id IN (1506,196,1899,2292,851,982,1113,1834,524,2489,1048,1441,197,1769,2031,983,2555,1245,1507,394,1049,1180,1442,1901,2163,722,984,395,526,2098,2229,1050,1312,1443,2,1902,2033,2164,1509,265,396,2099,1051,2623,1182,1444,1903,2165,2296,986,1117,69,1969,921,2493,2166,856,2428,987,2559,1118,2363,2494,1053,2625,1577,2036,2167,2298,988,2560,1250,2364,2495,6,268,1906,2168,2299,989,1120,1251,1841,1055,1448,7,1710,269,2169,2300,859,2431,2562,1383,1776,2366,2170,2563,1515,336,926,1188,1450,9,2171,730,1123,1189,1451,141,2303,2434,1124,207,1910,928,2500,1190,1321,2173,732,2304,863,994,1256,1518,929,2632,1322,1846,2305,2436,2567,1257,799,930,144,275,1847,734,2437,2568,800,931,2503,1062,1455,1586,1848,2176,997,2569,1390,1783,473,2045,604,1194,1325,998,2570,1260,474,2046,2177,802,2505,1326,1588,1850,409,2112,2571,1130,213,1785,475,2178,2506,1065,1196,1458,1589,541,2310,869,1000,1131,1262,1393,2179,738,935,1197,1328,149,542,804,2442,1001,1132,2049,2180,2377,936,1853,2115,2574,1133,1526,85,2050,2181,1330,1854,413,2116,675,1134,1265,217,2051,1331,1724,545,807,2576,1266,1528,349,611,873,2511,1201,1463,677,2380,1922,743,1333,154,2512,1530,1661,351,2316,1006,1858,2120,941,2513,1138,1400,90,1662,352,745,1007,2579,2645,25,156,1859,1990,549,2121,1532,746,1008,2580,1139,1205,1729,550,2384,1402,92,2450,1009,2581,1140,1337,944,1927,2189,1010,2582,1600,421,2255,945,2517,1666,1928,1011,2583,1142,1273,1863,553,2125,684,2387,946,2518,357,1929,488,1012,1274,1864,554,2257,816,620,751,1013,1144,1603,1865,555,948,2520,1341,490,2455,1014,2586,1145,1276,1604,556,687,2390,949,2521,1539,1932,622,1015,1408,164,295,1867,1998,688,1474,1540,1933,2195,754,2326,1016,2588,1278,689,755,1017,2589,1869,428,2000,690,821,952,1345,1476,625,756,2590,1411,101,1739,822,953,1215,1674,233,1019,1740,299,692,2395,1347,1478,37,2068,2461,2592,1151,169,1086,693,562,1741,1872,1283,1021,2200,366,2069,2593,1349,1087,956,1480,1873,2135,2659,367,1284,1415,2594,498,1153,2398,695,433,1743,1874,2529,1154,1023,630,1547,2333,1809,1940,2071,41,958,696,2203,631,1286,1417,1941,1352,959,2400,2531,2662,1156,1025,763,632,2466,1942,436,305,960,1484,1746,2532,2270,502,109,1157,1026,2205,1288,1943,175,1223,2533,1158,765,2337,2599,2075,1944,1093,962,831,2534,438,1159,1552,2338,1945,177,963,1880,2535,2666,112,1160,1029,767,2208,2601,1946,1095,964,2405,833,1750,1161,2209,2602,1096,965,2406,245,114,1424,2341,573,1359,1228,1097,966,2211,377,115,1032,1556,2604,2342,1949,770,1229,967,2408,836,2539,2670,378,247,116,1164,2605,2212,837,2278,1361,1099,968,1885,2671,117,1165,1034,2606,2213,576,2410,904,118,1166,1297,1428,2476,839,2280,577,53,1363,1232,970,905,1167,1429,1691,1822,1364,1233,2281,906,775,1037,1299,1430,2478,2413,2544,841,1038,907,776,252,1693,1955,2086,842,711,580,1235,2545,908,515,122,1170,1301,2218,253,974,1367,1891,450,778,123,1171,2350,975,713,1368,2023,2678,1172,910,779,648,255,124,1434,1565,2548,714,452,190,59,1238,1500,1173,1435,2483,2221,453,191,1632,1043,2353,1305,1436,1698,1829,2615,1109,978,2419,2288,454,1371,1895,1044,258,1306,2223,389,2551,979,2420,717,1765,2027,2682,1045,914,783,390,1569,2486,2617,1962,1111,980,2421,718,456,2290,1766,1177,915,1701,1243,2553,981,2422,850,1898,457,1047,916,1571,1964,261)) ORDER BY FIELD(id,261,438,37,756,92,802,1891,1834,524,2489,1048,1441,197,1769,2031,983,2555,1245,1507,394,1049,1180,1442,1901,2163,722,984,395,526,2098,2229,1050,1312,1443,2,1902,2033,2164,1509,265,396,2099,1051,2623,1182,1444,1903,2165,2296,986,1117,69,1969,921,2493,2166,856,2428,987,2559,1118,2363,2494,1053,2625,1577,2036,2167,2298,988,2560,1250,2364,2495,6,268,1906,2168,2299,989,1120,1506,1841,1055,1448,7,1710,269,2169,2300,859,2431,2562,1383,1776,2366,2170,2563,1515,336,926,1188,1450,9,2171,730,1123,1189,1451,141,2303,2434,1124,207,1910,928,2500,1190,1321,2173,732,2304,863,994,1256,1518,929,2632,1322,1846,2305,2436,2567,1257,799,930,144,275,1847,734,2437,2568,800,931,2503,1062,1455,1586,1964,2176,997,2569,1390,1783,473,2045,604,1194,1325,998,2570,1260,474,2046,2177,982,2505,1326,1588,1850,409,2112,2571,1130,213,1785,475,2178,2506,1065,1196,1458,1589,541,2310,869,1000,1131,1262,1393,2179,738,935,1197,1328,149,542,804,2442,1001,1132,2049,2180,2377,936,1853,2115,2574,1133,1526,85,2050,2181,1330,1854,413,2116,675,1134,1265,217,2051,1331,1724,545,807,2576,1266,1528,349,611,873,2511,1201,1463,677,2380,1922,743,1333,154,2512,1530,1661,351,2316,1006,1858,1571,941,2513,1138,1400,90,1662,352,745,1007,2579,2645,25,156,1859,1990,549,2121,1532,746,1008,2580,1139,1205,1729,550,2384,1402,916,2450,1009,2581,1140,1337,944,1927,2189,1010,2582,1600,421,2255,945,2517,1666,1928,1011,2583,1142,1273,1863,553,2125,684,2387,946,2518,357,1929,488,1012,1274,1864,554,2257,816,620,751,1013,1144,1603,1865,555,948,2520,1341,490,2455,1014,2586,1145,1276,1604,556,687,2390,949,2521,1539,1932,622,1015,1408,164,295,1867,1998,688,1474,1540,1933,2195,754,2326,1016,2588,1278,689,755,1017,2589,1869,428,2000,690,821,952,1345,1476,625,2292,2590,1411,101,1739,822,953,1215,1674,233,1019,1740,299,692,2395,1347,1478,1899,2068,2461,2592,1151,169,1086,693,562,1741,1872,1283,1021,2200,366,2069,2593,1349,1087,956,1480,1873,2135,2659,367,1284,1415,2594,1047,1153,2398,695,433,1743,1874,2529,1154,1023,630,1547,2333,1809,1940,2071,41,958,696,2203,631,1286,1417,1941,1352,959,2400,2531,2662,1156,1025,763,632,2466,1942,436,305,960,1484,1746,2532,2270,502,109,1157,1026,2205,1288,1943,175,1223,2533,1158,765,2337,2599,2075,1944,1093,962,831,2534,196,1159,1552,2338,1945,177,963,1880,2535,2666,112,1160,1029,767,2208,2601,1946,1095,964,2405,833,1750,1161,2209,2602,1096,965,2406,245,114,1424,2341,573,1359,1228,1097,966,2211,377,115,1032,1556,2604,2342,1949,770,1229,967,2408,836,2539,2670,378,247,116,1164,2605,2212,837,2278,1361,1099,968,1885,2671,117,1165,1034,2606,2213,576,2410,904,118,1166,1297,1428,2476,839,2280,577,53,1363,1232,970,905,1167,1429,1691,1822,1364,1233,2281,906,775,1037,1299,1430,2478,2413,2544,841,1038,907,776,252,1693,1955,2086,842,711,580,1235,2545,908,515,122,1170,1301,2218,253,974,1367,1113,450,778,123,457,2350,975,713,1368,2023,2678,1172,910,779,648,255,124,1434,1565,2548,714,452,190,59,1238,1500,1173,1435,2483,2221,453,191,1632,1043,2353,1305,1436,1698,1829,2615,1109,978,2419,2288,454,1371,1895,1044,258,1306,2223,389,2551,979,2420,717,1765,2027,2682,1045,914,783,390,1569,2486,2617,1962,1111,980,2421,718,456,2290,1766,1177,915,1701,1243,2553,981,2422,850,1898,1171,498,851,2120,1848,1251) DESC
from stmt.c:312:in oci8lib.so
from /home/cfrugard/projects/sitera/sitera/.bundle/ruby/1.8/gems/ruby-oci8-2.0.6/lib/oci8/oci8.rb:288:in `exec'
from /home/cfrugard/projects/sitera/sitera/.bundle/ruby/1.8/gems/activerecord-oracle_enhanced-adapter-1.4.0/lib/active_record/connection_adapters/oracle_enhanced_oci_connection.rb:141:in `exec'
from /home/cfrugard/projects/sitera/sitera/.bundle/ruby/1.8/gems/activerecord-oracle_enhanced-adapter-1.4.0/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:593:in `exec_query'
from /home/cfrugard/projects/sitera/sitera/.bundle/ruby/1.8/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract_adapter.rb:244:in `log'
from /home/cfrugard/projects/sitera/sitera/.bundle/ruby/1.8/gems/activesupport-3.1.1/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
from /home/cfrugard/projects/sitera/sitera/.bundle/ruby/1.8/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract_adapter.rb:239:in `log'
from /home/cfrugard/projects/sitera/sitera/.bundle/ruby/1.8/gems/activerecord-oracle_enhanced-adapter-1.4.0/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:1226:in `log'
from /home/cfrugard/projects/sitera/sitera/.bundle/ruby/1.8/gems/activerecord-oracle_enhanced-adapter-1.4.0/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:573:in `exec_query'
from /home/cfrugard/projects/sitera/sitera/.bundle/ruby/1.8/gems/activerecord-oracle_enhanced-adapter-1.4.0/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:1180:in `select'
from /home/cfrugard/projects/sitera/sitera/.bundle/ruby/1.8/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/database_statements.rb:18:in `select_all'
from /home/cfrugard/projects/sitera/sitera/.bundle/ruby/1.8/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/query_cache.rb:63:in `select_all'
from /home/cfrugard/projects/sitera/sitera/.bundle/ruby/1.8/gems/activerecord-3.1.1/lib/active_record/base.rb:470:in `find_by_sql'
from /home/cfrugard/projects/sitera/sitera/.bundle/ruby/1.8/gems/activerecord-3.1.1/lib/active_record/relation.rb:111:in `to_a'
from /home/cfrugard/projects/sitera/sitera/.bundle/ruby/1.8/gems/activerecord-3.1.1/lib/active_record/relation.rb:436:in `inspect'
from /usr/lib/ruby/1.8/irb.rb:310:in `output_value'
from /usr/lib/ruby/1.8/irb.rb:159:in `eval_input'
from /usr/lib/ruby/1.8/irb.rb:271:in `signal_status'
from /usr/lib/ruby/1.8/irb.rb:155:in `eval_input'
from /usr/lib/ruby/1.8/irb.rb:154:in `eval_input'
from /usr/lib/ruby/1.8/irb.rb:71:in `start'
from /usr/lib/ruby/1.8/irb.rb:70:in `catch'
from /usr/lib/ruby/1.8/irb.rb:70:in `start'
from /home/cfrugard/projects/sitera/sitera/.bundle/ruby/1.8/gems/railties-3.1.1/lib/rails/commands/console.rb:45:in `start'
from /home/cfrugard/projects/sitera/sitera/.bundle/ruby/1.8/gems/railties-3.1.1/lib/rails/commands/console.rb:8:in `start'
from /home/cfrugard/projects/sitera/sitera/.bundle/ruby/1.8/gems/railties-3.1.1/lib/rails/commands.rb:40
from script/rails:6:in `require'