Permalink
Browse files

[engines guide] wrap up 'Configuring an Engine' section

  • Loading branch information...
radar committed Oct 19, 2011
1 parent 8ede74e commit 1cc6105d4dd088e3f2b8026e7e49f4e9d8d7d6ea
Showing with 2 additions and 0 deletions.
  1. +2 −0 railties/guides/source/engines.textile
@@ -531,7 +531,9 @@ Blorgh.user_class = "User"
WARNING: It's very important here to use the +String+ version of the class, rather than the class itself. If you were to use the class, Rails would attempt to load that class and then reference the related table, which could lead to problems if the table wasn't already existing. Therefore, a +String+ should be used and then converted to a class using +constantize+ in the engine later on.
+Go ahead and try to create a new post. You will see that it works exactly in the same way as before, except this time the engine is using the configuration setting in +config/initializers/blorgh.rb+ to learn what the class is.
+There are now no strict dependencies on what the class is, only what the class's API must be. The engine simply requires this class to define a +find_or_create_by_name+ method which returns an object of that class to be associated with a post when it's created.
h3. Overriding engine functionality

0 comments on commit 1cc6105

Please sign in to comment.