No commit activity in last 3 years
No release in over 3 years
Adds Protector support to SimpleForm associations.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0

Runtime

 Project Readme

SimpleForm Protector

Adds Protector support to SimpleForm associations.

Installation

Add this line to your application's Gemfile:

gem "protector-simple_form"

And then run the following command to install it:

bundle

Usage

Associations

SimpleForm does a great job at dealing with associations (f.association helper) but when used in conjunction with Protector, it will not protect the collection used unless you specify it by hand using the :collection option.

This gem will protect the collections that are automatically generated by SimpleForm using the same subject as the object the association belongs to.

In the event where you'd rather not have the automatically generated collection protected, you can set the :protect option to false.

<%= simple_form_for @user do |f| %>
  <%= f.association :company, protect: false %>  # Association scope: `Company.all`
  <%= f.association :roles %>                    # Association scope: `Role.restrict!(@user.protector_subject)`
<% end %>

License

Copyright 2013 Deversus Software Inc. It is free software, and may be redistributed under the terms of MIT license.