Browse files

fix the example code in the engines guide. closes #8583.

  • Loading branch information...
1 parent fdf04fe commit 9e23399c3004afc6110c93d3df89c5209d39b20f @senny senny committed Feb 11, 2013
Showing with 8 additions and 0 deletions.
  1. +8 −0 guides/source/
@@ -650,6 +650,14 @@ = Blorgh.user_class.find_or_create_by(name: author_name)
Resulting in something a little shorter, and more implicit in its behavior. The `user_class` method should always return a `Class` object.
+Since we changed the `user_class` method to no longer return a
+`String` but a `Class` we must also modify our `belongs_to` definition
+in the `Blorgh::Post` model:
+belongs_to :author, class_name: Blorgh.user_class.to_s
To set this configuration setting within the application, an initializer should be used. By using an initializer, the configuration will be set up before the application starts and calls the engine's models which may depend on this configuration setting existing.
Create a new initializer at `config/initializers/blorgh.rb` inside the application where the `blorgh` engine is installed and put this content in it:

0 comments on commit 9e23399

Please sign in to comment.