#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2009
    Posts
    12
    Rep Power
    0

    Trouble deleting record


    Hello-

    I am able to add and retrieve database entries, but I'm unable to delete a record.

    Lots of blogs say that http://localhost:3000/users/1?_method=DELETE should do it. I enter that in the browser and it just displays the info for entry '1'.

    I also sent a POST request (I'm using Flex) with the url being http://localhost:3000/users/1 and { _method : "DELETE" } as parameters but the call fails saying "No action responded to 1. Actions: create, destroy, [....]"

    Can someone please guide me? I've been searching all over.

    Here's my destroy action for 'searches':
    Code:
      # DELETE /searches/1
      # DELETE /searches/1.xml
      def destroy
        @search = Search.find(params[:id])
        @search.destroy
    
        respond_to do |format|
          format.html { redirect_to(searches_url) }
          format.xml  { head :ok }
        end
      end
    And here's what's in the log:

    // here's the select working fine
    Code:
    Processing SearchesController#index to xml (for 127.0.0.1 at 2009-11-13 10:42:23) [GET]
      Search Load (81.6ms)   SELECT * FROM "searches" 
    Completed in 173ms (View: 84, DB: 82) | 200 OK [http://localhost/searches.xml?]
    // here's the delete failing
    Code:
    Processing SearchesController#3 (for 127.0.0.1 at 2009-11-13 10:42:29) [POST]
      Parameters: {"3"=>nil}
    
    ActionController::UnknownAction (No action responded to 3. Actions: create, destroy, edit, index, new, show, and update):
     
    Rendering rescues/layout (not_found)
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2009
    Posts
    12
    Rep Power
    0
    Still haven't figured this out. Are people at a loss or is there more information I should provide? I feel like I've tried everything and it seems like it should be so simple.
    Thanks.

IMN logo majestic logo threadwatch logo seochat tools logo