I would like to add in-place editing functionality to my application,
but I fetch & store the data from/into a weird source that requires some
transformations to be done before displaying & storing the content.
A slightly (over)simplified example could be the following.
Assume that I have a table "data" with two columns:
id name
-- ----
1 XX
2 XXXX
3 XXX
show.html.erb would return the following for each object:
data/1
------
this is id: 1
length: 2 [edit button]
------
data/2
------
this is id: 2
length: 4 [edit button]
------
data/3
------
this is id: 3
length: 3 [edit button]
------
I would like to press [edit button] (or a simple link) that should
change the number into editable field that should only accept numbers.
------
this is id: 2
length: |_4_| [save button]
------
And when changing 4 into 6 and pressing [save button] I want to modify
the name in database to store six X characters instead of four:
id name
-- ----
1 XX
2 XXXXXX
3 XXX
and return to normal show page:
data/2
------
this is id: 2
length: 6 [edit button]
------
Is there a simple way to do that with existing macros? (I''m using rails
2.1.)
Thanks a lot,
Mojca
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---