Skip to content

How to change controllers, models, views, assets, localizations...

atd edited this page Apr 17, 2012 · 2 revisions

Social Stream is a Rails Engine. This means that you can customize every single file in app/. All you have to do is copy the file from Social Stream's gem to you application's app/. Your application's file will take precedence over the original file in Social Stream

Social Stream is distributed as a gem. To find where Social Stream is installed, you can use bundle show social_stream-base, bundle show social_stream-documents, etc.

The same applies to localization messages. Entries in you application's config/locales/* take precedence over Social Stream's.

Note that files copied to your application will not be updated when Social Stream is updated. They will not get new features and bug fixes. There is a way to avoid this in the case of app/models. Some of them use ActiveSupport lazy load hooks to add functionalities on models. All you have to do is:

  • Create a module that adds the functionality:
module MyFunctionality
 ...
end
  • Create an initializer in config/initializers that includes the module using lazy hooks:
ActiveSupport.on_load(:user) do
  include MyFunctionality
end