0

I am trying to access the store collection in a component's config/initializers/boot.rb file to declare some middleware to blacklist an array of IP addresses. Unfortunately I am getting an error of:

#<NameError: undefined local variable or method `store' for main:Object>

Is it possible to access the store collection here?

user3579220
  • 187
  • 1
  • 2
  • 9

2 Answers2

0

You should use this:

Volt.current_app.store
gabrielrios
  • 554
  • 1
  • 4
  • 12
  • Unfortunately, that does not work. For some reason, I can access the page collection by using "Volt.current_app.page" but not the store method. – user3579220 Jul 14 '15 at 13:32
  • Ok, indeed, the StoreRoot is present, but I couldn't access any data. Maybe you should move your logic to a different file and run it with `volt runner`, it won't be when the server start but might be the only way – gabrielrios Jul 14 '15 at 13:39
  • That could be one way to do it. I can't even access the StoreRoot from Volt.current_app – user3579220 Jul 14 '15 at 14:05
  • Are you on volt 0.9.4? If you're not you might try the `$store` global. – gabrielrios Jul 14 '15 at 14:09
  • I am using volt 0.9.4.pre4. Also $store just returns nil. – user3579220 Jul 14 '15 at 14:34
0
$page.store.sub_collections

works correctly.

user3579220
  • 187
  • 1
  • 2
  • 9