I've got an application where the user can set up a folder to keep notes in. What I had previously was a hidden form field to store the id of the person who created it, i.e.:
<%=f.hidden_field 'user_id', :value => current_user.id %>
However, I now need to add a 'keyholder', who has read-only access to this folder. I have a list of links, which only appear if the user has added a folder, or the keyholder can set one up for them.
The keyholder is a regular user themselves, so the above code would only set up a folder with their own id, not that of the person whose account they are accessing. The keyholder has an 'access_id' that matches the user id of the the person whose account they can access.
How do I set it up so that the form is capturing the right user id?
What I'm trying to acheive is the following (this doesn't work, but might give a better idea of what I mean):
<% if current_user.access.folder.nil? %>
<li><%= link_to 'Create a Folder',
new_folder_path(:user_id => current_user.access_id) %></li>
<% end %>
And what would I need to change in the folder form partial to get it to accept this user id? Thanks!