Good Morning, Rick,
I just woke up and thought, “Hey, I didn’t give the items an id ...”,
but then realized the field is auto-indexed by Sqlite3. Ah, but then
there are fields something like date_created, etc. Like Scarlett in
“Gone With The Wind”, I decided to think about that after I check my
newsgroup to see if someone generously posted a needed insight.
Thank you again for graciously sharing your hard-earned RoR insights
with newbies like me as well as others.
Amazingly, I was just up to page 27 in “Practical REST on Rails 2
Projects”, which includes an inset entitled “Route Inspection: Rake
Routes”. I surely will be studying that.
For the moment, I think I understand the major error in my plan on
updating the database due to new or changed data in the “/public/data/
csv” directory. Here’s my new plan:
1. I should include a “:before => :check_csv_status” in “/app/
2. Then that “checker” can determine whether the “/public/data/csv”
directory has changed. That can be done by:
- check the timestamps;
- validate saved checksums; or
- compare against saved and hidden copies.
3. Then if any difference is found, put up a flash notice that the
system is “stale” and have a always-visible “update cvs table” link.
4. Then “update cvs table” can use a portion of the techniques in “app/
controllers/csv_items_controller.rb” to accomplish adding new items,
updating existing ones and removing ones according to the current
content of the “/public/data/csv” directory. And thus the database
will be brought up to speed.
5. For efficiency, perhaps a global, initially “false”,
“cvs_table_up-to-date” switch should be set so that the check is only
made at the beginning of a session. Users who tamper with the “/
public/data/csv” directory mid-session do so at their peril.
6. Maybe the last step of the update cvs table should be the command I
heard so often in the military: “As you were!”, which translates to
“resume the process you were involve in when you clicked the “update
cvs table” link. I don’t know how to do that right now, but I’ll
figure it out in due time.
Does this sound like a coherent design to you.
Again, Rick, thanks for your guidance.