ruby-hyperloop / hyper-model

The project has moved to Hyperstack!! - Isomorphic ActiveRecord wrapper for Hyperloop
https://hyperstack.org/
MIT License
1 stars 1 forks source link

Hyperloop::AccessViolation on lap28 with Rails 5.2 #13

Closed psmir closed 6 years ago

psmir commented 6 years ago

The following code in the render method gives me such an error: Hyperloop::AccessViolation

p = Post.first
H3{ p.title } if p.present?

This error occures when I try to iterate over posts either:

Post.all.each do |p|
   H3{ p.title }
end
catmando commented 6 years ago

In order to prevent unauthorized access to information like scope counts, lists of record ids, etc, Hyperloop now (see issue https://github.com/ruby-hyperloop/hyper-mesh/issues/43) requires you explicitly allow scopes to be viewed on the client, otherwise you will get an AccessViolation.

To globally allow access to all scopes add this to the ApplicationRecord class

class ApplicationRecord < ActiveRecord::Base
  regulate_scope :all
end
catmando commented 6 years ago

@fzingg @barriehadfield I assigned this to you, just as a reminder that we have to document the entire scope regulation system.

psmir commented 6 years ago

@catmando thank you

barriehadfield commented 6 years ago

website and gem docs updated