Hi, I am brand new to Rails and I love it, but I am stuck on something
I just can’t figure out.
I have table in my database of Pages which are listed in the admin
view in an HTML table.
Each page has
ID
Title
Content
Page_order
The HTML table displays:
Title
Page_order
The HTML table has some jQuery attached to it that allows me to sort
the rows up and down, and then updates the text inside the Page_order
table cells to be in numerical order. In other words:
| Title | Page Order |
| About | 0 |
| Contact | 1 |
| Pricing | 2 |
Say you want Contact to be at the bottom (since the nav menu on the
web site is ordered by page_order). So you drag Pricing above Contact
and you’ll see:
| Title | Page Order |
| About | 0 |
| Pricing | 1 |
| Contact | 2 |
This I can make work. The part I don’t know how to do is send an ajax
request to update the database and change the page_order values to
reflect the changes.
Can someone help?