El Friday 20 February 2009 10:12:43 Pradeep Gatram escribió:
> Till the rails 2.1 version, excluding the delete action meant that the
> controller will not at all respond to delete and destroy requests.
> Specifically ActionController::UnknownAction was raised whenever these
> actions were invoked.
>
> In the rails 2.2 version, I am seeing a different behaviour. delete
> action responds normally while the destroy action sends back some kind
> of rjs (some error i guess). I do see that the record has not been
> destroyed, so my data is quite safe.
>
> Obviously, I came across this issue while upgrading to rails 2.2. I
> had some tests to ensure that delete/destroy do not work even if
> someone types in the appropriate url. These tests broke and thats how
> I found this change.
>
> class FooControllerTest < ActionController::TestCase
> def test_delete
> begin
> get :delete, {:id => foos(:one).id}
> flunk "Deleting should not be supported."
> rescue ActionController::UnknownAction
> end
> end
>
> def test_destroy
> begin
> get :destroy, {:id => foos(:one).id}
> flunk "Destroying should not be supported."
> rescue ActionController::UnknownAction
> end
> end
> end
>
> Any idea what was the rationale behind this change? Also do post back
> if you see anything glaringly wrong with my approach.
>
> Btw, I've already gone down the path of defining delete_authorized?
> method to always return false. And that did not help my cause
> either. :)
I can't reproduce it.
I have an UsersController with config.actions.exclude :delete
in script/console:
>> UsersController.new.respond_to? :delete
=> false
>> UsersController.new.respond_to? :destroy
=> false
>> UsersController.new.respond_to? :list
=> true
--
Sergio Cambra .:: entreCables S.L. ::.
Nicolás Guillén 6, locales 2 y 3. 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---