2nd Ratpack Prototype Project - Mocked CRUD Groovy Script/App

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

2nd Ratpack Prototype Project - Mocked CRUD Groovy Script/App

dbirtwell
Hey all:

I'm working on a port of a Sinatra/Ruby CRUD application I did last Summer.

Right now it is the beginning of a Mocked CRUD app (with no actual tie to a DB) and is in the starting phase.

I've put it in GitHub at:

https://github.com/dbirtwell/trackmystuff_ratpack_no_db

I'm wondering if I'm going down the correct path with the form post and the delete.

I'm using a "get" right now for the delete and just started thinking about posting the form.

Any feedback would be appreciated.

Hey, maybe this could help others too

Dave
Reply | Threaded
Open this post in threaded view
|

Re: 2nd Ratpack Prototype Project - Mocked CRUD Groovy Script/App

dbirtwell
I revised the delete to have a form which displays an "Yes, Delete it" submission button and a cancel selection.

Below is the code for the form:

        <form action="item/${model.id}" method="post">       
           
                <input type="hidden" name="_method" value="delete">
                <input type="submit" value="Yes, Delete It!">
                Cancel
        </form>

If you select the submission button, you are redirected to the "delete" route:

        post ("delete/item/:id") {
          // do stuff here to delete the Item
        }

I'm not sure if this is the 100% correct way, but it works.

Any advice or suggestions would be appreciated.

Thanks,

Dave