Christian,

I disabled all of my protect_from_forgery stuff to get around it for now 
:). 

This does make me wonder if either:

1) protect_from_forgery doesn't apply to all POST requests, but only 
certain actions implicitly (e.g. "create" "update" "delete" etc.)
2) the edit_associated call is actually a GET and not a POST or 
something weird like that (I'm not sure that really makes sense though).

Wes

[email protected] wrote:
> I had the same thing this morning with a new project I had just
> created.
> I had to add the following line to my child controller:
>
> protect_from_forgery :only => [:create, :update, :delete]
>
> In your case, I think it will have to be put in the controller
> associated to the sub-form.
> This is only a workaround, though. There is probably a cleaner way to
> do it.
>
> Christian.
>
> On Feb 24, 7:54 am, Wes Gamble <[email protected]> wrote:
>   
>> All,
>>
>> Rails 2.3
>> AS - latest from github as of 02/24 00:22 CST.
>>
>> I have two models which are in a has_many/belongs_to relationship.
>>
>> If I try to create/edit either of these models and then attempt to
>> create/update the associated model through the default subform, I get the
>>
>> ActionController::InvalidAuthenticityToken
>>
>>     in XYZController#edit_associated
>>
>> error on the AJAX call to do the update.
>>
>> Here's one of the stack traces - not sure how useful it will be:
>>
>> ActionController::InvalidAuthenticityToken
>> (ActionController::InvalidAuthenticityToken):
>>   actionpack (2.3.0)
>> lib/action_controller/request_forgery_protection.rb:79:in
>> `verify_authenticity_token'
>>   activesupport (2.3.0) lib/active_support/callbacks.rb:178:in
>> `evaluate_method'
>>   activesupport (2.3.0) lib/active_support/callbacks.rb:166:in `call'
>>   actionpack (2.3.0) lib/action_controller/filters.rb:225:in `call'
>>   actionpack (2.3.0) lib/action_controller/filters.rb:629:in
>> `run_before_filters'
>>   actionpack (2.3.0) lib/action_controller/filters.rb:615:in `call_filters'
>>   actionpack (2.3.0) lib/action_controller/filters.rb:610:in
>> `perform_action_with_filters'
>>   actionpack (2.3.0) lib/action_controller/benchmarking.rb:68:in
>> `perform_action_with_benchmark'
>>   actionpack (2.3.0) lib/action_controller/benchmarking.rb:68:in
>> `perform_action_with_benchmark'
>>   actionpack (2.3.0) lib/action_controller/rescue.rb:154:in
>> `perform_action_with_rescue'
>>   actionpack (2.3.0) lib/action_controller/flash.rb:141:in
>> `perform_action_with_flash'
>>   actionpack (2.3.0) lib/action_controller/base.rb:523:in `process'
>>   actionpack (2.3.0) lib/action_controller/filters.rb:606:in
>> `process_with_filters'
>>   actionpack (2.3.0) lib/action_controller/base.rb:391:in `process'
>>   actionpack (2.3.0) lib/action_controller/base.rb:386:in `call'
>>   actionpack (2.3.0) lib/action_controller/routing/route_set.rb:433:in
>> `call'
>>   actionpack (2.3.0) lib/action_controller/dispatcher.rb:65:in `dispatch'
>>   actionpack (2.3.0) lib/action_controller/dispatcher.rb:88:in `_call'
>>   actionpack (2.3.0) lib/action_controller/dispatcher.rb:59:in `initialize'
>>   activerecord (2.3.0) lib/active_record/query_cache.rb:29:in `call'
>>   activerecord (2.3.0) lib/active_record/query_cache.rb:29:in `call'
>>   activerecord (2.3.0)
>> lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
>>   activerecord (2.3.0) lib/active_record/query_cache.rb:9:in `cache'
>>   activerecord (2.3.0) lib/active_record/query_cache.rb:28:in `call'
>>   actionpack (2.3.0) lib/action_controller/params_parser.rb:15:in `call'
>>   actionpack (2.3.0) lib/action_controller/rewindable_input.rb:25:in `call'
>>   actionpack (2.3.0) lib/action_controller/session/cookie_store.rb:93:in
>> `call'
>>   actionpack (2.3.0) lib/action_controller/failsafe.rb:11:in `call'
>>   actionpack (2.3.0) lib/action_controller/rack_ext/lock.rb:15:in `call'
>>   actionpack (2.3.0) lib/action_controller/dispatcher.rb:83:in `call'
>>   rails (2.3.0) lib/rails/rack/static.rb:27:in `call'
>>   rails (2.3.0) lib/rails/rack/log_tailer.rb:17:in `call'
>>   :1:in `initialize'
>>
>> Any thoughts?
>>
>> Thanks,
>> Wes
>>     
> >
>
>   

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to