mirror of
				https://github.com/varvet/pundit.git
				synced 2022-11-09 12:30:11 -05:00 
			
		
		
		
	Merge pull request #717 from drewmoore/update-documentation-for-headless-policies
Remove Struct inheritance from headless policy example
This commit is contained in:
		
						commit
						54675c6f9b
					
				
					 1 changed files with 11 additions and 2 deletions
				
			
		
							
								
								
									
										13
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								README.md
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -196,8 +196,17 @@ you can retrieve it by passing a symbol.
 | 
			
		|||
 | 
			
		||||
```ruby
 | 
			
		||||
# app/policies/dashboard_policy.rb
 | 
			
		||||
class DashboardPolicy < Struct.new(:user, :dashboard)
 | 
			
		||||
  # ...
 | 
			
		||||
class DashboardPolicy
 | 
			
		||||
  attr_reader :user
 | 
			
		||||
 | 
			
		||||
  # _record in this example will just be :dashboard
 | 
			
		||||
  def initialize(user, _record)
 | 
			
		||||
    @user = user
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def show?
 | 
			
		||||
    user.admin?
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue