README.md in strong-permitter-0.0.2 vs README.md in strong-permitter-0.0.3

- old
+ new

@@ -1,10 +1,11 @@ +[![Build Status](https://travis-ci.org/evg2108/strong-permitter.svg?branch=optional_resource_name_and_tests)](https://travis-ci.org/evg2108/strong-permitter) [![Gem Version](https://badge.fury.io/rb/strong-permitter.svg)](https://badge.fury.io/rb/strong-permitter) # StrongPermitter -This gem allows move params permissions from controllers to separated permission-objects. +This gem allows move params permissions from controllers to separated permission-objects. Used strong parameters whitelists. ## Installation Add this line to your application's Gemfile: @@ -44,11 +45,24 @@ update_params :content # for non-standard actions permissions use: # allowed_params_for :action_name, :param1, :param2, ... allowed_params_for :activate_article, :activation_status + + # also, you can set default resource name for this permission object (by default used controller name): + # self.resource_name = :blog end ``` + +If you need use different resource names for different actions, you may set optional last argument `:resource` in `create_params`, `update_params` or `allowed_params_for` methods, like this: + +```Ruby +class ArticlesPermission < StrongPermitter::Permission::Base + create_params :title, :description, :author_name, resource: :blog + update_params :title, :text, :blog_id, resource: :blog_post +end +``` + After that, you may use `permitted_params` method for your action methods: ```ruby class ArticlesController < ApplicationController