Rails is based on conventions, one of those is that you'll want to be using a SQL database. We don't. So what things should we do differently.
The major difference from this Gemfile and a freshly generated Rails application is that we're not using sqlite and we have required couchbase instead.
require File.expand_path('../boot', __FILE__) # require 'rails/all' # # require "active_record/railtie" require "action_controller/railtie" # require "action_mailer/railtie" # require "active_resource/railtie" # require "rails/test_unit/railtie" if defined?(Bundler) # If you precompile assets before deploying to production, use this line # Bundler.require *Rails.groups(:assets => %w(development test)) # If you want your assets lazily compiled in production, use this line Bundler.require(:default, :assets, Rails.env) end module CouchbaseTinyurl class Application Rails::Application # ... config.encoding = "utf-8" # Configure sensitive parameters which will be filtered from the log file. config.filter_parameters += [:password] # Enable the asset pipeline config.assets.enabled = true end end
Out of the box, Rails will require rails/all which will load all aspects of Rails. For this application we only need action_controller. This cuts the boot time down significantly.
CouchbaseTinyurl::Application.configure do # ... # config.action_mailer.raise_delivery_errors = false # ... end
One last thing to ensure unloading all those other Rails modules doesn't hurt us. We need to remove the action_mailer configuration options for Development and Test environments.
Now that we've got our application configured just right for using Couchbase we can start connecting with the server. You would connect to the address of the server (in this case it is 127.0.0.1 which is the IPV4 address of localhost.