Ruby on Rails
Tuesday, October 2, 2018
Good Morning Everyone...
-- I have a coding question just so I am clear on the proper way to do this...
To start, I have an app that I use Pundit in to control access to data, so I have a lot of calls that are like policy_scope(User)
What is the proper way to populate a select on a form with this data?
Initially I was just using policy_scope(User).collect
However I don't think it is proper to use this in a view, is it?
If not, what is the proper way to pull this data and provide it to the form?
Recently I have moved some of these to helpers and created a method like "users_for_select"
John
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/85ad77d7-60b1-456f-aaaf-2f7f98878903%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment