Dynamic user field (EAV) in a Rails application (FLLCasts)
At FLLCasts.com we have new user attributes that we could create dynamically.
Search more for EAV and the many pros and cons of using it. It is one of those subjects software architects (like us) like to discuss over a beer. (Well this and entropy)
Just wanted to share that we've started using hydra_attribute and we are rather please with the results.
The attributes are added with a db migration:
class AddHydraAttributesToUser < ActiveRecord::Migration def up User.hydra_attributes.create({name: 'need_for_team_mentoring', backend_type: 'boolean', default_value: false, white_list: true}) ... end def down User.hydra_attributes.delete 'need_for_team_mentoring' ... end end
and the ui is pretty simple:
<li><%= f.check_box :need_for_team_mentoring %><%= f.label "Mentoring a team", :class => "checkbox inline"%></li>
Now the difficult part comes - how to make users actually fill this profile fields.















