Re: [Radiant] Page saving error

2010-12-13 Thread William Ross
On 13 Dec 2010, at 09:01, rcz wrote:

> In Radiant CMS when I'm trying to save any page that has any PageType
> but "normal" (Archive, Index,etc.) I get this error:
> 
> NoMethodError in Admin/pagesController#update
> 
> undefined method `[]' for nil:NilClass
> 
> With clean Radiant everything's work, my radiant carried with some
> extension, which may cause problem. Can anyone give me any clue how
> can I solve this problem? Thanks.

It is an extension problem. It should be easy to find and you can probably 
eliminate it by changing the order in which the extensions load. 

I think one of your extensions is calling 
Page.accepts_nested_attributes(:something) too late. Some Page subclasses have 
already been created, and they don't get the call. When you try to save a page 
with one of those classes (ArchivePage, etc) it doesn't know what to do with 
the nested attributes in the form. The error you see is due to an absence of 
nested_attributes_options.

First you need to work out which of your extensions is responsible. There are 
two ways to do that: either add some debugging lines to 
vendor/radiant/vendor/rails/
activerecord/lib/active_record/nested_attributes.rb or (more easily), search 
through all the files in vendor/extensions looking for the string 
accepts_nested_attributes and see what stands out.

Then you need to make sure that troublesome extension loads before there is any 
inheritance from Page. To do that you uncomment this line in 
config/environment.rb:

# config.extensions = [ :all ]

and prepend the name of your extension:

config.extensions = [:something, :all]

> ps. I apologize for my poor English.

Your English seems excellent to me. Please do say if anything here is unclear.

best,

will





> 
> stack trace:
> 
> NoMethodError in Admin/pagesController#update
> 
> undefined method `[]' for nil:NilClass
> 
> RAILS_ROOT: F:/Work/Rails/Radiant/dev_version/test_app
> Application Trace | Framework Trace | Full Trace
> 
> F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
> activerecord/lib/active_record/nested_attributes.rb:335:in
> `assign_nested_attributes_for_collection_association'
> F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
> activerecord/lib/active_record/nested_attributes.rb:244:in
> `fields_attributes='
> F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
> activerecord/lib/active_record/base.rb:2906:in `send'
> F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
> activerecord/lib/active_record/base.rb:2906:in `assign_attributes'
> F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
> activerecord/lib/active_record/base.rb:2902:in `each'
> F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
> activerecord/lib/active_record/base.rb:2902:in `assign_attributes'
> F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
> activerecord/lib/active_record/base.rb:2775:in `attributes='
> F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
> activerecord/lib/active_record/base.rb:2669:in `update_attributes!'
> F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/app/
> controllers/admin/resource_controller.rb:64:in `update'
> F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
> actionpack/lib/action_controller/base.rb:1331:in `send'
> F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
> actionpack/lib/action_controller/base.rb:1331:in
> `perform_action_without_filters'
> F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
> actionpack/lib/action_controller/filters.rb:617:in `call_filters'
> F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
> actionpack/lib/action_controller/filters.rb:638:in
> `run_before_filters'
> F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
> actionpack/lib/action_controller/filters.rb:189:in `call'
> F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
> actionpack/lib/action_controller/filters.rb:189:in `call'
> F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
> actionpack/lib/action_controller/filters.rb:635:in
> `run_before_filters'
> F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
> actionpack/lib/action_controller/filters.rb:615:in `call_filters'
> F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
> actionpack/lib/action_controller/filters.rb:610:in
> `perform_action_without_benchmark'
> F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
> actionpack/lib/action_controller/benchmarking.rb:68:in
> `perform_action_without_rescue'
> F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
> activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
> F:/Work/Ruby187/p302/lib/ruby/1.8/benchmark.rb:308:in `realtime'
> F:/Work/Rails/Radiant/dev

Re: [Radiant] Page saving error

2010-12-13 Thread Joshua Danger French
On Dec 13, 2010, at 4:01 AM, rcz wrote

> In Radiant CMS when I'm trying to save any page that has any PageType
> but "normal" (Archive, Index,etc.) I get this error:
> 
> NoMethodError in Admin/pagesController#update
> 
> undefined method `[]' for nil:NilClass


Are you running in development mode? If so, try opening config/environment.rb 
and changing this line:

config.time_zone = 'UTC'

To this:

config.active_record.default_timezone = :utc

There's a persistent Activerecord bug: 
https://rails.lighthouseapp.com/projects/8994/tickets/1339

If you're not in dev mode, or if that doesn't solve it, you've got other 
problems. Let us know.

[Radiant] Page saving error

2010-12-13 Thread rcz
In Radiant CMS when I'm trying to save any page that has any PageType
but "normal" (Archive, Index,etc.) I get this error:

NoMethodError in Admin/pagesController#update

undefined method `[]' for nil:NilClass

With clean Radiant everything's work, my radiant carried with some
extension, which may cause problem. Can anyone give me any clue how
can I solve this problem? Thanks.

ps. I apologize for my poor English.

stack trace:

NoMethodError in Admin/pagesController#update

undefined method `[]' for nil:NilClass

RAILS_ROOT: F:/Work/Rails/Radiant/dev_version/test_app
Application Trace | Framework Trace | Full Trace

F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
activerecord/lib/active_record/nested_attributes.rb:335:in
`assign_nested_attributes_for_collection_association'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
activerecord/lib/active_record/nested_attributes.rb:244:in
`fields_attributes='
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
activerecord/lib/active_record/base.rb:2906:in `send'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
activerecord/lib/active_record/base.rb:2906:in `assign_attributes'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
activerecord/lib/active_record/base.rb:2902:in `each'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
activerecord/lib/active_record/base.rb:2902:in `assign_attributes'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
activerecord/lib/active_record/base.rb:2775:in `attributes='
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
activerecord/lib/active_record/base.rb:2669:in `update_attributes!'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/app/
controllers/admin/resource_controller.rb:64:in `update'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
actionpack/lib/action_controller/base.rb:1331:in `send'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
actionpack/lib/action_controller/base.rb:1331:in
`perform_action_without_filters'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
actionpack/lib/action_controller/filters.rb:617:in `call_filters'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
actionpack/lib/action_controller/filters.rb:638:in
`run_before_filters'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
actionpack/lib/action_controller/filters.rb:189:in `call'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
actionpack/lib/action_controller/filters.rb:189:in `call'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
actionpack/lib/action_controller/filters.rb:635:in
`run_before_filters'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
actionpack/lib/action_controller/filters.rb:615:in `call_filters'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
actionpack/lib/action_controller/filters.rb:610:in
`perform_action_without_benchmark'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
actionpack/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
F:/Work/Ruby187/p302/lib/ruby/1.8/benchmark.rb:308:in `realtime'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
actionpack/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
actionpack/lib/action_controller/rescue.rb:160:in
`perform_action_without_flash'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
actionpack/lib/action_controller/flash.rb:151:in `perform_action'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
actionpack/lib/action_controller/base.rb:532:in `send'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
actionpack/lib/action_controller/base.rb:532:in
`process_without_filters'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
actionpack/lib/action_controller/filters.rb:606:in `sass_old_process'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/
plugins/haml/lib/sass/plugin/rails.rb:20:in `process'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
actionpack/lib/action_controller/base.rb:391:in `process'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
actionpack/lib/action_controller/base.rb:386:in `call'
F:/Work/Rails/Radiant/dev_version/test_app/vendor/radiant/vendor/rails/
actionpack/lib/action_controller/rout