I''m a Java programmer and am new to Rails and Ruby so be gentle. <Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> I''m not sure this is the appropriate group for this question. I''m sure you''ll let me know if it isn''t. I''ve a Rails app that uses a "Tickets" table. I used the scaffold to generate the controller. I can show a list of rows in the table with the "list" URL and I can "Show" any one of the records in the result as expected. But when I try to "Edit" any one of the records I get this error in the browser: --------------------------------------------------------------- NoMethodError in Tickets#edit Showing /tickets/_form.rhtml where line #7 raised: undefined method `store'' for #<Ticket:0x23b36f4> Extracted source (around line #7): 4: 5: <!--[form:ticket]--> 6: <p><label for="ticket_store">Store</label><br/> 7: <%= text_field ''ticket'', ''store'' %></p> 8: 9: <p><label for="ticket_order_id">Order</label><br/> 10: <%= text_field ''ticket'', ''order_id'' %></p> -------------------------------------------------------------- One of the fields of the table is "store". So I figure there is a "store" method somewhere that should return the value of the store field for the "current" row. Also I figure that this is the way that the "Show" works (and it seems to work fine). How can I debug this? Where is the "store" method supposed to be? I''ve searched the app and it doesn''t appear in any of the .rb files. The database connection is ok since I can list and show records ok. The error only occurs when the edit form is called. _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Hi Richard, THe reason you can''t find the ''store'' method is because it is determined (reflectively) at runtime using the ''method_missing'' method on ActiveRecord::Base *. If you''re interested in the code check out C:\ruby\lib\ruby\gems\1.8\gems\activerecord-1.12.1\lib\active_record\base.rb line 1371 (or equiv on nix). If you want to have a look at the object you are trying to display you can call @ticket.inspect, which will print out a (reasonably) readable representation of the object. You should see the ''store'' in the ''attributes'' area. You could either put <%= @ticket.inspect %> in your template or maybe put render :text => @ticket.inspect and return in your controller. HTH a little, Dan * method_missing is executed by Ruby as part of an error handling routine