For my website, I’m building a module-based customizable system, so
users can pick their own modules and display them on their profile
page. I want to make this as componentized as possible, but the
following has me scratching my head.
My module table has an options TEXT field, in which I’d like to store
marshalled options data for that specific module. I’ve set up
everything so I can make custom templates for each module, and use
the data provided in the options field. What I can’t get to work is
the following. An example. One of the modules is a Last.fm browse
recently played tracks module. For that, I need to store the last.fm
username of the user in the db. So, options => { :username =>
“foo” }. I’d like to be able to use it directly in my view, using
something like <%= text_field ‘options’, ‘username’ %>. I seem to
lack some understanding of the way Marshal.load and .dump creates
data structures, so I really can’t get this to work. I’ve tried
things like: