On 26 November 2010 20:37, Markus Zm <li...@ruby-forum.com> wrote:

To repeat myself:
Please don't top post, it makes it difficult to follow the thread.  It
is better to nsert your comments in appropriate places in previous
post.  Thanks.

> My idea is that I have users, who are responsible for maintaining or for
> reviewing records relating to one or many companies. The other way round
> a company' records can be maintained or reviewed by many users.
> In the 'type' attribute I would like to store the role of the user as
> 'read-only' or 'write' flags.
>
> I would like to define the authorization in a form that lists for a
> given user all existing companies and then the admin can select via
> radio-buttons for each company if the user should have 'no access',
> 'view' or 'write' access to the companies records. Submitting the form
> shall update the authorizations for all companies for that user.
> My intension was to store the type of authorization in the addtional
> datafield, but I don't know how to access it.

If you have a company then you can get all the responsibles for that
company and hence the type field and the user.  Similarly if you have
a user then you have all his responsibles and for each one the type
and company.  So in a view you might have something like
@users.responsibles.each do |responsible|
  display responsible.company and responsible.type
end

I think Responsibility might read better as a model name by the way.

Does that help?

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to