vendor/plugins/active_scaffold/lib/extensions/
name_option_for_datetime.rb
EVERYTHING WORKS AFTER EDITING
NEEDS TO BE PATCHED:
AFTER PATCHING - LOOKS LIKE THIS:
#vendor/plugins/active_scaffold/lib/extensions/
name_option_for_datetime.rb:
module ActionView
module Helpers
class InstanceTag
private
# patch in support for options[:name]
def datetime_selector_with_name(options, html_options)
datetime = value(object) || default_datetime(options)
options = options.dup
options[:field_name] = @method_name
options[:include_position] = true
options[:prefix] ||= @object_name
options[:index] ||= @auto_index
options[:datetime_separator] ||= ' — '
options[:time_separator] ||= ' : '
PATCH HERE WORKS: (#{options[:position]}i) WAS BEFORE - NOT WORKING: (#
{position}i)
options.merge(:prefix => options[:name].dup.insert(-2, "(#
{options[:position]}i)")) if options[:name]
STOP HERE:
DateTimeSelector.new(datetime, options.merge(:tag => true),
html_options)
end
alias_method_chain :datetime_selector, :name
end
end
end
On Dec 2, 10:19 pm, sanjayayogi <[EMAIL PROTECTED]> wrote:
> ActiveRecord::Schema.define(:version => 20081202200659) do
>
> create_table "items", :force => true do |t|
> t.integer "item_id"
> t.string "item_name"
> t.text "item_description"
> t.integer "item_category_id"
> t.integer "item_amount"
> t.integer "item_quantity"
> t.date "date_item_purchased" (WHEN I DROP THIS COLUMN
> EVERYTHING WORKS??!!)
> t.datetime "created_at"
> t.datetime "updated_at"
> end
>
> end
>
> On Dec 2, 9:58 pm, sanjayayogi <[EMAIL PROTECTED]> wrote:
>
> > 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 onhttp://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'
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---