Double data entry

Hi Tim,

First off, I have an interest in this sort of application myself. Please contact me off-list if you would like additional help.

The proper way to do double entry rather depends on your workflow. * Do you have the same person enter the data twice? * Does the second entry happen at a different time, or do you want to do it all in one form?

As a general rule, double entry makes for a bad user interface, but there are times when it is necessary (password verifications show up a lot).

In any event, one way to implement this would be through an 'edit' like action.

- record has been entered - user invokes the 'verify' action on the record. - 'verify' generates a blank form (much like a new item form) but passes the id of the record in a hidden field - on submission, load the original object in memory - cycle through all the attributes of the record looking for differences. Ignore at 'created_at' like attributes. - If all the relevant columns pass, then update the 'verified_at' with the timestamp of when it passed the test. - If not, then assign the 'errors' for the record and re-render the form with the discrepancies highlighted.

_Kevin www.sciwerks.com

Just a thought, my acts_as_modified plugin may be of use to you when looking for differences between the records.

You could assign the new values to the original record then use record.modified_attributes see any differences.

http://svn.viney.net.nz/things/rails/plugins/acts_as_modified

-Jonathan.

The docs should be enough:

http://svn.viney.net.nz/things/rails/plugins/acts_as_modified/lib/acts_as_modified.rb

But just quickly, you can do:

@subject = Subject.find(params[:id]) @subject.attributes = { :name => “New name” }

@subject.modified_attributes # { :name => “Old name” } @subject.name_modified?

true

@subject.original_name # “Old Name”

@subject.modified? # true

Feel free to email me off-list if you want more assistance with the plugin.

-Jonathan.