Welcome Guest, Not a member yet? Register   Sign In
Saving Column Preferences of an User in DB - Rails
#1

[eluser]Unknown[/eluser]
I am trying to save the column preferences of an user in rails db. When an user logs in for first time the flexigrid displays all columns by default and then, say if the user hides 3 out of 10 columns, the remaining 7 need to be stored(persisted) in db and next time when the user logs in and uses grid page the result should show those 7 columns and not all 10. I need help in implementing this logic.
My Approach - Create a new Prefs table and add relation with existing User table.
Code:
belongs_to_many  :user
. Add a line in User model
Code:
has_many :prefs
. Need help in the controller/model logic to save the selection changes in a DB and retrive them eveytine the user accesses the flexigrid page.

TIA.




Theme © iAndrew 2016 - Forum software by © MyBB