-
Notifications
You must be signed in to change notification settings - Fork 15
FAQ
- Can I use any other database engine than SQLite?
- Can I have more than you instance of the project in the same machine?
- Can I use an external smtp server to send e-mails?
You can change any configuration concerning the database in the file config/database.yml.
The file should be something like this:
# SQLite version 3.x
# gem install sqlite3
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000The file itself is really suggestive. It has three different environments: development, test and production. Each environment have this set of options:
- adapter
- encoding
- database
- pool
- username
- password
- socket
- host
- port
- timeout
Once again, each option name is suggestive. The most important part is the adapter, which tells Rails which database engine you are using so it can use the matching engine syntax.
Some examples of adapters:
- mysql2 (MySQL)
- postgresql (PostgreSQL)
- sqlite3 (SQLite)
If you change your database adapter you should probably also change the adapter in the Gemfile file. If not, when running rake db:setup, the rake will complain about it.
Yes, but you should edit the file config/initializers/session_store.rb and give new names to the cookies in a way that they will not conflict with the other instance of the project.
Yes (thanks to Guilherme Nasseh)! In this case, please, edit the file config/environments/production.rb commenting config.action_mailer.sendmail_settings and adding config.action_mailer.smtp_settings with the following configuration:
config.action_mailer.delivery_method = :sendmail
config.action_mailer.default_url_options = { :host => 'www.foo.com/sapos' }
#config.action_mailer.sendmail_settings = { :arguments => '-i -f "SAPOS <sapos@www.foo.com>"', :location => '/usr/sbin/sendmail' }
config.action_mailer.smtp_settings = {
address: "smtp.bar.com",
port: 587,
domain: "www.foo.com",
authentication: "plain",
enable_starttls_auto: true,
user_name: ENV["email"],
password: ENV["password"]
Obs.: remember to replace www.foo.com by the SAPOS server domain, smtp.bar.com by the SMTP server, and email/password by your SMTP authentication data.