1. Define an environment variable in .bashrc or .profile on the server:
export SECRET_KEY_BASE='a long string generated by running rake secret'
2. In secrets.yml file :
secret_key_base=<%= ENV['SECRET_KEY_BASE'] %>
3. MyBlog::Application.config.secret_key_base = Rails.application.secrets.secret_key_base
Remember: After deployment all the old sessions will become invalid.