Ok, I searched but couldn''t find anything and I even tried the RoR IRC channel with no help. I get this error: uninitialized constant Airport I used this code which I got from the RoR site. helper :sorting def list @sorter = SortingHelper::Sorter.new self, %w(icao host_id name), @params[''sort''], @params[''order''], ''icao'', ''ASC'' @pages = Paginator.new self, Airport.count, 10, @params[''page''] @airports = Airport.find_all nil, @sorter.to_sql, @pages.current.to_sql render_action ''none'' if 0 == @airports.length end Can anyone help? If you need more information I will give it if I can. BTW, I''m a RoR newbie so if this is something really simple, I''m sorry. -- Posted via http://www.ruby-forum.com/.
On 2/2/06, Joshua Kendall <joshua@domhelp.com> wrote:> Ok, I searched but couldn''t find anything and I even tried the RoR IRC > channel with no help. > > I get this error: > > uninitialized constant Airport > > I used this code which I got from the RoR site. > > helper :sorting > > def list > @sorter = SortingHelper::Sorter.new self, %w(icao host_id name), > @params[''sort''], @params[''order''], ''icao'', ''ASC'' > @pages = Paginator.new self, Airport.count, 10, @params[''page''] > @airports = Airport.find_all nil, @sorter.to_sql, > @pages.current.to_sql > > render_action ''none'' if 0 == @airports.length > end > > Can anyone help? If you need more information I will give it if I can. > > BTW, I''m a RoR newbie so if this is something really simple, I''m sorry. >Try putting "model :airport" on the line above "helper :sorting" That shouldn''t be necessary if the Airport model is in app/models/airport.rb, or if this controller is called "Airports" or "Airport", but it will probably fix it. --Wilson.
Thanks Wilson, but just by dumb luck I figured it out. I replaced my list with: def list @sorter = SortingHelper::Sorter.new self, %w(event course section date), @params[''sort''], @params[''order''], ''date'', ''ASC'' @pages = Paginator.new self, Dates.count, 10, @params[''page''] @dates = Dates.find_all nil, @sorter.to_sql, @pages.current.to_sql render_action ''none'' if 0 == @dates.length end It was a stupid mistake of not realizing that I needed to change Airport(s) to Date(s). :) -- Posted via http://www.ruby-forum.com/.