I just performed a couple of migrations - one adding database columns: def self.up add_column :properties_sfar_commercial, :auctions_desc, :string add_column :properties_sfar_commercial, :bank_owned_desc, :string add_column :properties_sfar_commercial, :short_sales_desc, :string add_column :properties_sfar_commercial, :trades_desc, :string add_column :properties_sfar_commercial, :listing_price, :string add_column :properties_sfar_commercial, :selling_price, :string add_column :properties_sfar_commercial, :selling_date, :string add_column :properties_sfar_commercial, :selling_agent_id, :string add_column :properties_sfar_commercial, :selling_agent_name, :string add_column :properties_sfar_commercial, :selling_co_agent_id, :string add_column :properties_sfar_commercial, :selling_co_agent_name, :string add_column :properties_sfar_commercial, :selling_office_id, :string add_column :properties_sfar_commercial, :selling_office_name, :string add_column :properties_sfar_commercial, :selling_co_office_id, :string add_column :properties_sfar_commercial, :selling_co_office_name, :string end one removing: def self.up remove_column :properties_sfar_commercial, :area_display remove_column :properties_sfar_commercial, :search_price remove_column :properties_sfar_commercial, :co_office_phone remove_column :properties_sfar_commercial, :garage_spaces remove_column :properties_sfar_commercial, :virtual_tour_url remove_column :properties_sfar_commercial, :contact_phone_1 remove_column :properties_sfar_commercial, :co_agent_phone_1 remove_column :properties_sfar_commercial, :price_change end And now that all columns are as they should be (I think?) I get this error on rake: ** Invoke idx:load_properties (first_time) ** Execute idx:load_properties ** Execute idx:update_db rake aborted! no implicit conversion from nil to integer /var/www/apps/quickidx/releases/20080519171438/lib/idx/sfar_commercial.rb:16:in `[]'' /var/www/apps/quickidx/releases/20080519171438/lib/idx/sfar_commercial.rb:16:in `map_property'' /var/www/apps/quickidx/releases/20080519171438/lib/tasks/idx.rake:84 /var/www/apps/quickidx/releases/20080519171438/lib/quickidx.rb:142:in `parse'' /var/www/apps/quickidx/releases/20080519171438/lib/quickidx.rb:136:in `parse'' /var/www/apps/quickidx/releases/20080519171438/lib/tasks/idx.rake:52 /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:544:in `execute'' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `execute'' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:508:in `invoke_with_call_chain'' /usr/lib/ruby/1.8/thread.rb:135:in `synchronize'' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `invoke_with_call_chain'' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:518:in `invoke_prerequisites'' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1183:in `each'' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:515:in `invoke_prerequisites'' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:507:in `invoke_with_call_chain'' /usr/lib/ruby/1.8/thread.rb:135:in `synchronize'' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `invoke_with_call_chain'' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:494:in `invoke'' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1931:in `invoke_task'' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `top_level'' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `top_level'' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in `standard_exception_handling'' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:in `top_level'' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:in `run'' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in `standard_exception_handling'' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in `run'' /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31 /usr/bin/rake:16 I''m new at Ruby on Rails but know that we are running 2.0.2 and this would be the first time we have ever seen this error. Anyone able to diagnose? Thanks much -- Posted via http://www.ruby-forum.com/.
On Jun 12, 6:30 pm, Caroline Blaker <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> ** Invoke idx:load_properties (first_time) > ** Execute idx:load_properties > ** Execute idx:update_db > rake aborted! > no implicit conversion from nil to integer > /var/www/apps/quickidx/releases/20080519171438/lib/idx/sfar_commercial.rb:1 6:in > `[]'' > /var/www/apps/quickidx/releases/20080519171438/lib/idx/sfar_commercial.rb:1 6:inHave you had a look at the code here ? Fred> `map_property'' > /var/www/apps/quickidx/releases/20080519171438/lib/tasks/idx.rake:84 > /var/www/apps/quickidx/releases/20080519171438/lib/quickidx.rb:142:in > `parse'' > /var/www/apps/quickidx/releases/20080519171438/lib/quickidx.rb:136:in > `parse'' > /var/www/apps/quickidx/releases/20080519171438/lib/tasks/idx.rake:52 > /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:544:in `execute'' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `execute'' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:508:in > `invoke_with_call_chain'' > /usr/lib/ruby/1.8/thread.rb:135:in `synchronize'' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in > `invoke_with_call_chain'' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:518:in > `invoke_prerequisites'' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1183:in `each'' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:515:in > `invoke_prerequisites'' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:507:in > `invoke_with_call_chain'' > /usr/lib/ruby/1.8/thread.rb:135:in `synchronize'' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in > `invoke_with_call_chain'' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:494:in `invoke'' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1931:in `invoke_task'' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `top_level'' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `top_level'' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in > `standard_exception_handling'' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:in `top_level'' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:in `run'' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in > `standard_exception_handling'' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in `run'' > /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31 > /usr/bin/rake:16 > > I''m new at Ruby on Rails but know that we are running 2.0.2 and this > would be the first time we have ever seen this error. > > Anyone able to diagnose? Thanks much > -- > Posted viahttp://www.ruby-forum.com/.
Frederick Cheung wrote:> On Jun 12, 6:30�pm, Caroline Blaker <rails-mailing-l...@andreas-s.net> > wrote: >> ** Invoke idx:load_properties (first_time) >> ** Execute idx:load_properties >> ** Execute idx:update_db >> rake aborted! >> no implicit conversion from nil to integer >> /var/www/apps/quickidx/releases/20080519171438/lib/idx/sfar_commercial.rb:1 6:in >> `[]'' >> /var/www/apps/quickidx/releases/20080519171438/lib/idx/sfar_commercial.rb:1 6:in > > Have you had a look at the code here ? > > FredYes, but as a newbie, errors cause and solutions don''t just, you know, jump off the page. Plus, I didn''t build this system but am assigned to maintain it, so every new thing is just that. A new thing. To me it looks like "1 space 6" in array. But what does that mean and how do I fix it? I''m not trying to look stupid. I''m just trying to get my work done. thanks for taking the time to help.. -- Posted via http://www.ruby-forum.com/.
Look at line 16 of sfar_commercial.rb. The error indicates that some variable (or return value) is nil when then code was expecting an integer. My guess is that it was trying to index an array with nil (hence the reference to ''[]''). On Jun 12, 1:54 pm, Caroline Blaker <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Frederick Cheung wrote: > > On Jun 12, 6:30 pm, Caroline Blaker <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > wrote: > >> ** Invoke idx:load_properties (first_time) > >> ** Execute idx:load_properties > >> ** Execute idx:update_db > >> rake aborted! > >> no implicit conversion from nil to integer > >> /var/www/apps/quickidx/releases/20080519171438/lib/idx/sfar_commercial.rb:1 6:in > >> `[]'' > >> /var/www/apps/quickidx/releases/20080519171438/lib/idx/sfar_commercial.rb:1 6:in > > > Have you had a look at the code here ? > > > Fred > > Yes, but as a newbie, errors cause and solutions don''t just, you know, > jump off the page. > Plus, I didn''t build this system but am assigned to maintain it, so > every new thing is just that. A new thing. To me it looks like "1 space > 6" in array. But what does that mean and how do I fix it? I''m not trying > to look stupid. I''m just trying to get my work done. > > thanks for taking the time to help.. > -- > Posted viahttp://www.ruby-forum.com/.
Paul Lynch wrote:> Look at line 16 of sfar_commercial.rb. The error indicates that some > variable (or return value) is nil when then code was expecting an > integer. My guess is that it was trying to index an array with nil > (hence the reference to ''[]''). > > On Jun 12, 1:54�pm, Caroline Blaker <rails-mailing-l...@andreas-s.net>Ok - this line is as follows property[:area] = data[map[''area_display'']] Not surprisingly this would refer to one of the columns that I just migrated out! Apparently the feed author has discontinued it and now that my databases are updated I''m getting this error. But I *did migrate it out. I suppose this file does not follow awareness of migrations. In any case, is it OK just to comment out this line? I know that Ruby is a sensitive system to a lot of scrap hap hazard cutting around the code. But hey! that''s what its there for right? Thanks for all your help. -- Posted via http://www.ruby-forum.com/.
In my project, the developer who writes a migration that changes tables is typically the same person who changes the code to work with the changes. But, it sounds like you got these migrations from a third-party source, someone who is responsible for the data but not the code written to use it? Anyway, I would recommend checking to see how "property[:area]" gets used before commenting out the line. There could be other changes needed. You should also check on how the program uses the other columns that were removed. (The column names should most likely appear somewhere in the code). You might also want to think about whether your program needs to do something with the new columns. This will all probably involve a lot of digging through the code, reading it, and understanding what it is doing and why. On Jun 12, 2:09 pm, Caroline Blaker <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Paul Lynch wrote: > > Look at line 16 of sfar_commercial.rb. The error indicates that some > > variable (or return value) is nil when then code was expecting an > > integer. My guess is that it was trying to index an array with nil > > (hence the reference to ''[]''). > > > On Jun 12, 1:54 pm, Caroline Blaker <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > Ok - this line is as follows > > property[:area] = data[map[''area_display'']] > > Not surprisingly this would refer to one of the columns that I just > migrated out! Apparently the feed author has discontinued it and now > that my databases are updated I''m getting this error. But I *did migrate > it out. I suppose this file does not follow awareness of migrations. > > In any case, is it OK just to comment out this line? I know that Ruby is > a sensitive system to a lot of scrap hap hazard cutting around the code. > But hey! that''s what its there for right? > > Thanks for all your help. > -- > Posted viahttp://www.ruby-forum.com/.
2009/6/12 Caroline Blaker <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> > Paul Lynch wrote: >> Look at line 16 of sfar_commercial.rb. The error indicates that some >> variable (or return value) is nil when then code was expecting an >> integer. My guess is that it was trying to index an array with nil >> (hence the reference to ''[]''). >> >> On Jun 12, 1:54�pm, Caroline Blaker <rails-mailing-l...@andreas-s.net> > > Ok - this line is as follows > > property[:area] = data[map[''area_display'']] > > Not surprisingly this would refer to one of the columns that I just > migrated out! Apparently the feed author has discontinued it and now > that my databases are updated I''m getting this error. But I *did migrate > it out. I suppose this file does not follow awareness of migrations. >All the migration does is to change the structure of the database. That file (sfar_commercial.rb) is part of the application written by the original builder. Someone will have to work out what the code was doing and work out what it should now do instead. Good luck Colin