mirror of
				https://github.com/varvet/pundit.git
				synced 2022-11-09 12:30:11 -05:00 
			
		
		
		
	Make a note of manual policy class specification
This commit is contained in:
		
							parent
							
								
									75683fe159
								
							
						
					
					
						commit
						5ad9821ae1
					
				
					 1 changed files with 13 additions and 0 deletions
				
			
		
							
								
								
									
										13
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								README.md
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -195,6 +195,19 @@ You can, and are encouraged to, use this method in views:
 | 
			
		|||
<% end %>
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Manually specifying policy classes
 | 
			
		||||
 | 
			
		||||
Sometimes you might want to explicitly declare which policy to use for a given
 | 
			
		||||
class, instead of letting Pundit infer it. This can be done like so:
 | 
			
		||||
 | 
			
		||||
``` ruby
 | 
			
		||||
class Post
 | 
			
		||||
  def self.policy_class
 | 
			
		||||
    PostablePolicyClass
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Just plain old Ruby
 | 
			
		||||
 | 
			
		||||
As you can see, Pundit doesn't do anything you couldn't have easily done
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue