Added custom initializer


(James Robinson) #1

Just to be certain, I’ve added a custom initializer file to the initializers folder, will this be picked up when the app starts?

Cheers


(Alan Tan) #2

Have a look at


(James Robinson) #3

thanks, i’ve already created the plugin per the guide but it’s not clear where the initializer file should go?

somewhere like this…

plugins/my-plugin/config/initializers/initializer.rb

or would the code just simply go in an after_initialize block in the plugin.rb file?

Basically, i create a site_setting with the plugin and then straight away i need to be able to use that setting

much appreciated


(Robin Ward) #5

I suggest you look at the source code of one of our plugins such as discourse-tagging for further examples if it’s not clear from the guides.

Adding a site setting is covered in part 3 and no initializer is required.