1

I'm currently working on a Rails app that allows users to add "Widgets" to the homepage of the app when logged in. These widgets will consist of twitter feeds, flickr feeds, other rss feeds, etc...There will also be an administration area where admins can add/manage what widgets are available for users to add. Also, each app needs it's own custom set of options that the user will be required to enter when adding that widget (e.g for twitter, a twitter username is required).

For days I've been trying to figure out how the logic behind this should work. At first My thought was to dynamically build the widget on the fly and store all widgets / widget configuration information in database tables like:

Widgets
   - name
   - description
   - feed_url

Widgets Settings
   - widget_id
   - name 
   - field type (text, textarea, etc...)
   - required

User Widgets
   - user_id
   - widget_id

User Widget Settings
   - user_id
   - widget_id
   - widget_setting_id
   - value

So, basically the admins would add widgets to the Module table (e.g Twitter) Then add configuration fields for that module in the Widget Settings table (twitter_username). But how to associate the config options to the widget when constructing them is where I'm having issues.

Another option would be to hardcode everything and stick it in the lib/ directory. But that would kill all flexibility / dynamic functionality.

Does any of this sound like it could work?

Any advice would be very much appreciated!

2
  • 1
    'But how to associate the config options to the widget when constructing them is where I'm having issues.' What issues? What belongs_to associations do you have in your models?
    – RSG
    Mar 29, 2011 at 15:15
  • I'm confused about your question. Your question is "does the design that I've laid out seem reasonable"? If so, that doesn't seem like a great question for Stack Overflow. If one person says "Yes" and another person says "No", which answer will you accept?
    – Phrogz
    Mar 30, 2011 at 16:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.