Added custom initializer

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

Have a look at

1 Like

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

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.

6 Likes