THIS PROBLEM IS RELATED TO THE PRESENCE OF: date_item_purchased:date IN MY SAMPLE DATABASE; WHEN I REMOVE THAT COLUMN - EVERYTHING WORKS!! ANOTHER BUG??( I AM USING RAILS 2.2.2 )
[EMAIL PROTECTED]:~/www/items$ script/server => Booting Mongrel (use 'script/server webrick' to force WEBrick) => Rails 2.2.2 application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server ** Starting Mongrel listening at 0.0.0.0:3000 ** Starting Rails with development environment... ** Rails loaded. ** Loading any Rails specific GemPlugins ** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart). ** Rails signals registered. HUP => reload (without restart). It might not work well. ** Mongrel 1.1.5 available at 0.0.0.0:3000 ** Use CTRL-C to stop. ActiveScaffold: extending RESTful routes for items SQL (0.2ms) SET SQL_AUTO_IS_NULL=0 Item Columns (4.5ms) SHOW FIELDS FROM `items` Processing ItemsController#index (for 127.0.0.1 at 2008-12-02 21:38:36) [GET] SQL (0.1ms) SELECT count(*) AS count_all FROM `items` Item Load (0.1ms) SELECT `items`.* FROM `items` ORDER BY items.`id` ASC LIMIT 0, 15 CACHE (0.0ms) SELECT `items`.* FROM `items` ORDER BY items.`id` ASC LIMIT 0, 15 Rendering template within layouts/items Rendering items/list Rendered _list_header (3.0ms) Rendered _list_column_headings (12.2ms) Rendered _messages (0.4ms) SQL (0.1ms) SELECT sum(`items`.item_amount) AS sum_item_amount FROM `items` Rendered _list_calculations (2.8ms) Rendered _list (23.8ms) Completed in 62ms (View: 40, DB: 5) | 200 OK [http://localhost/items] SERVER STARTS NO PROBLEM - http://localhost:3000/items SHOWS AN EMPTY active_scaffold - (nothing in the database) WHEN I CLICK ON NEW - IT THROWS THE FOLLOWING ERROR: Processing ItemsController#new (for 127.0.0.1 at 2008-12-02 21:39:57) [GET] Parameters: {"adapter"=>"_list_inline_adapter"} Rendered _form_attribute (0.8ms) Rendered _form_attribute (0.7ms) Rendered _form_attribute (0.7ms) Rendered _form_attribute (0.7ms) Rendered _form_attribute (0.7ms) Rendered _form_attribute (0.7ms) Rendered _form_attribute (0.7ms) ActionView::TemplateError (undefined local variable or method `position' for #<ActionView::Helpers::InstanceTag:0xb66f1c2c>) on line #7 of vendor/plugins/active_scaffold/frontends/default/views/ _form_attribute.rhtml: 4: <label for="<%= active_scaffold_input_options(column, scope) [:id] %>"><%= column.label %></label> 5: </dt> 6: <dd> 7: <%= active_scaffold_input_for column, scope %> 8: <% if column.description -%> 9: <span class="description"><%= column.description %></span> 10: <% end -%> vendor/plugins/active_scaffold/lib/extensions/ name_option_for_datetime.rb:16:in `datetime_selector' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ helpers/date_helper.rb:832:in `to_date_select_tag_without_error_wrapping' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ helpers/active_record_helper.rb:268:in `to_date_select_tag' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ helpers/active_record_helper.rb:237:in `to_tag' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ helpers/active_record_helper.rb:22:in `input' vendor/plugins/active_scaffold/lib/active_scaffold/helpers/ form_column_helpers.rb:35:in `active_scaffold_input_for' vendor/plugins/active_scaffold/frontends/default/views/ _form_attribute.rhtml:7 /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ renderable.rb:39:in `send' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ renderable.rb:39:in `render' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ renderable_partial.rb:20:in `render' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ benchmarking.rb:26:in `benchmark' /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ core_ext/benchmark.rb:8:in `realtime' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ benchmarking.rb:26:in `benchmark' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ renderable_partial.rb:19:in `render' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ template.rb:73:in `render_template' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ renderable_partial.rb:45:in `render_partial' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ partials.rb:152:in `render_partial' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ base.rb:258:in `render_without_active_scaffold' vendor/plugins/active_scaffold/lib/extensions/ action_view_rendering.rb:61:in `render' vendor/plugins/active_scaffold/frontends/default/views/_form.rhtml: 14 vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/ action_columns.rb:69:in `each' vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/ action_columns.rb:56:in `each' vendor/plugins/active_scaffold/frontends/default/views/_form.rhtml: 2 /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ renderable.rb:39:in `send' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ renderable.rb:39:in `render' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ renderable_partial.rb:20:in `render' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ benchmarking.rb:26:in `benchmark' /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ core_ext/benchmark.rb:8:in `realtime' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ benchmarking.rb:26:in `benchmark' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ renderable_partial.rb:19:in `render' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ template.rb:73:in `render_template' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ renderable_partial.rb:45:in `render_partial' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ partials.rb:152:in `render_partial' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ base.rb:258:in `render_without_active_scaffold' vendor/plugins/active_scaffold/lib/extensions/ action_view_rendering.rb:61:in `render' vendor/plugins/active_scaffold/frontends/default/views/ _create_form.rhtml:37 /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ renderable.rb:39:in `send' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ renderable.rb:39:in `render' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ renderable_partial.rb:20:in `render' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ benchmarking.rb:26:in `benchmark' /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ core_ext/benchmark.rb:8:in `realtime' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ benchmarking.rb:26:in `benchmark' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ renderable_partial.rb:19:in `render' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ template.rb:73:in `render_template' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ renderable_partial.rb:45:in `render_partial' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ partials.rb:152:in `render_partial' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/ base.rb:258:in `render_without_active_scaffold' vendor/plugins/active_scaffold/lib/extensions/ action_view_rendering.rb:61:in `render' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ base.rb:926:in `render_without_benchmark' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ benchmarking.rb:51:in `render_without_active_scaffold' /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ core_ext/benchmark.rb:8:in `realtime' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ benchmarking.rb:51:in `render_without_active_scaffold' vendor/plugins/active_scaffold/lib/extensions/ action_controller_rendering.rb:13:in `render' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ base.rb:948:in `render_to_string' vendor/plugins/active_scaffold/lib/extensions/ action_controller_rendering.rb:9:in `render' vendor/plugins/active_scaffold/lib/active_scaffold/actions/ create.rb:22:in `new' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ mime_responds.rb:135:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ mime_responds.rb:135:in `custom' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ mime_responds.rb:164:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ mime_responds.rb:164:in `respond' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ mime_responds.rb:158:in `each' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ mime_responds.rb:158:in `respond' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ mime_responds.rb:107:in `respond_to' vendor/plugins/active_scaffold/lib/active_scaffold/actions/ create.rb:13:in `new' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ base.rb:1253:in `send' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ base.rb:1253:in `perform_action_without_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ filters.rb:617:in `call_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ filters.rb:610:in `perform_action_without_benchmark' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ benchmarking.rb:68:in `perform_action_without_rescue' /usr/lib/ruby/1.8/benchmark.rb:293:in `measure' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ benchmarking.rb:68:in `perform_action_without_rescue' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ rescue.rb:136:in `perform_action_without_caching' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ caching/sql_cache.rb:13:in `perform_action' /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ connection_adapters/abstract/query_cache.rb:34:in `cache' /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ query_cache.rb:8:in `cache' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ caching/sql_cache.rb:12:in `perform_action' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ base.rb:524:in `send' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ base.rb:524:in `process_without_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ filters.rb:606:in `process_without_session_management_support' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ session_management.rb:134:in `process' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ base.rb:392:in `process' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ dispatcher.rb:183:in `handle_request' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ dispatcher.rb:110:in `dispatch_unlocked' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ dispatcher.rb:123:in `dispatch' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ dispatcher.rb:122:in `synchronize' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ dispatcher.rb:122:in `dispatch' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ dispatcher.rb:132:in `dispatch_cgi' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ dispatcher.rb:39:in `dispatch' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb: 76:in `process' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb: 74:in `synchronize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb: 74:in `process' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/ configurator.rb:282:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/ configurator.rb:281:in `each' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/ configurator.rb:281:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb: 212:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281 /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ dependencies.rb:142:in `load_without_new_constant_marking' /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ dependencies.rb:142:in `load' /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ dependencies.rb:521:in `new_constants_in' /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ dependencies.rb:142:in `load' /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/servers/ mongrel.rb:64 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ dependencies.rb:153:in `require' /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ dependencies.rb:521:in `new_constants_in' /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ dependencies.rb:153:in `require' /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' script/server:3 Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/templates/rescues/_trace (205.2ms) Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/templates/rescues/_request_and_response (3.2ms) Rendering /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/templates/rescues/layout.erb (internal_server_error) HOW I AM CRE rails items -d mysql EDIT config/database.yml with localhost mysql db password rake db:create:all script/generate scaffold Item item_id:integer item_name:string item_description:text item_category_id:integer item_amount:integer item_quantity:integer date_item_purchased:date rake db:migrate git clone git://github.com/activescaffold/active_scaffold.git vendor/ plugins/active_scaffold && rm -rf vendor/plugins/active_scaffold/.git MODIFY CONTROLLERS: #app/controllers/application.rb class ApplicationController < ActionController::Base ActiveScaffold.set_defaults do |config| config.ignore_columns.add [:created_at, :updated_at, :lock_version] end helper :all # include all helpers, all the time # See ActionController::RequestForgeryProtection for details # Uncomment the :secret if you're not using the cookie session store protect_from_forgery # :secret => '842bf68a04d17859ed4be719a0078e1d' # See ActionController::Base for details # Uncomment this to filter the contents of submitted sensitive data parameters # from your application log (in this case, all fields with names like "password"). # filter_parameter_logging :password end #app/controllers/items_controller.rb class ItemsController < ApplicationController # GET /items # GET /items.xml active_scaffold :item do |config| config.columns = [:id, :item_name, :item_description, :item_category_id, :item_amount, :item_quantity, :date_item_purchased] config.columns[:item_amount].calculate = :sum end end FIX THE BUG IN ACTIVE_SCAFFOLD BY COPYING THE FOLLOWING FILE TO THE DIRECTORY (BECAUSE config.columns[:item_amount].calculate = :sum IS THROWING AN ERROR-THIS PATCH FIXES THAT PROBLEM) # vendor/plugins/active_scaffold/frontends/default/views/ _list_calculations.rhtml <% display_class = ( @records.kind_of?(Array) ? @records.first : @records ) -%> <tr id="<%= active_scaffold_calculations_id %>" class="active-scaffold- calculations"> <% active_scaffold_config.list.columns.each do |column| -%> <td> <% if column.calculation? -%> <% calculation = column_calculation(column) override_formatter = "render_#{column.name}_# {column.calculate}" calculation = self.method(override_formatter).call (calculation) if respond_to? override_formatter -%> <%= calculation.to_s -%> <% else -%> <% end -%> </td> <% end -%> <% unless active_scaffold_config.action_links.empty? -%> <td class="actions"> </td> <% end -%> </tr> #app/controllers/application.rb # Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. MODIFY THE app/views/layouts/items.html.erb by including: <%= javascript_include_tag :defaults %> <%= active_scaffold_includes %> #app/views/layouts/items.html.erb <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> <title>Items: <%= controller.action_name %></title> <%= javascript_include_tag :defaults %> <%= active_scaffold_includes %> </head> <body> <p style="color: green"><%= flash[:notice] %></p> <%= yield %> </body> </html> ADD ACTIVE_SCAFFOLD TO THE ROUTES.RB #config/routes.rb ActionController::Routing::Routes.draw do |map| map.resources :contacts, :active_scaffold => true # The priority is based upon order of creation: first created -> highest priority. # Sample of regular route: # map.connect 'products/:id', :controller => 'catalog', :action => 'view' # Keep in mind you can assign values other than :controller and :action # Sample of named route: # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase' # This route can be invoked with purchase_url(:id => product.id) # Sample resource route (maps HTTP verbs to controller actions automatically): # map.resources :products # Sample resource route with options: # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get } # Sample resource route with sub-resources: # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller # Sample resource route with more complex sub-resources # map.resources :products do |products| # products.resources :comments # products.resources :sales, :collection => { :recent => :get } # end # Sample resource route within a namespace: # map.namespace :admin do |admin| # # Directs /admin/products/* to Admin::ProductsController (app/ controllers/admin/products_controller.rb) # admin.resources :products # end # You can have the root of your site routed with map.root -- just remember to delete public/index.html. # map.root :controller => "welcome" # See how all your routes lay out with "rake routes" # Install the default routes as the lowest priority. # Note: These default routes make all actions in every controller accessible via GET requests. You should # consider removing the them or commenting them out if you're using named routes and resources. map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' end START MONGREL on port 3000 - http:localhost:3000/items script/serverATING THE SAMPLE APP - items SORRY FOR THE LONG POST- ANY BODY HAVE ANY IDEAS?? It is related to the --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/activescaffold?hl=en -~----------~----~----~----~------~----~------~--~---
