unobliged / plymlet

plymlet rails test code
http://plymlet.herokuapp.com
0 stars 0 forks source link

Model: Passage, add vocab_list #22

Closed unobliged closed 12 years ago

unobliged commented 12 years ago

Given that we can store a vocabulary list for a User with a serialized text field, we can do the same for each passage so there no longer needs to be a Redis lookup for the words. The flow should change such that when a passage is created, the lookup is done in advance and the Vocab_List field is updated. The administrative view for editing a passage should call that function so the Passage Vocab_List is updated.

unobliged commented 12 years ago

Notes/Possible Features: -Dictionaries should be loaded into Redis in advance or some other key/value store used locally -There should also be some way for a content author to choose the relevant definition for a word given the context of a passage.

unobliged commented 12 years ago

Make a rake task to populate passage vocab_list field, it was a bad idea to try to do this from the view/update. On a side note, explore custom rake tasks more; currently being underutilized: http://railscasts.com/episodes/66-custom-rake-tasks http://stackoverflow.com/questions/1450112/how-do-i-use-helpers-in-rake Incidentally that would explain why I ended up putting some functions in the Passages Helper file, I had an old custom rake task I forgot about (lib/tasks/...).

unobliged commented 12 years ago

Hstore might be an alternative to serialization and/or Redis, but it seems to only be well supported in future Rails (4.0+). See: http://travisjeffery.com/b/2012/02/using-postgress-hstore-with-rails/ Will stick with serialization for now and switch over in the future. Update: It might be best to switch over to hstore before going live, Redis is expensive and the dictionaries are big (100k+ entries per language usually). That or use AWS and run it on the instance since base has 1GB+ RAM. -Hstore requires new db, trashing old one. Redis is still faster for local development and for demo purposes Note: There are now two rake tasks, one to save new vocabulary to Redis and the other to save to each Passage.vocab_list

unobliged commented 12 years ago

Will open new issue to address multiple definitions for same word and plans for Redis, pg hstore. Basic points of original issue completed, albeit through rake tasks in the interim.