Follow the steps below to setup a local development environment:
Recommended to download latest XQuartz
| # Call scopes directly from your URL params: | |
| # | |
| # @products = Product.filter(params.slice(:status, :location, :starts_with)) | |
| module Filterable | |
| extend ActiveSupport::Concern | |
| module ClassMethods | |
| # Call the class methods with names based on the keys in <tt>filtering_params</tt> | |
| # with their associated values. For example, "{ status: 'delayed' }" would call |
| # Enables PostgreSQL interval datatype support (as ActiveSupport::Duration) in Ruby on Rails 4.1. | |
| # Based on https://gist.github.com/clarkdave/6529610 | |
| require 'active_support/duration' | |
| # add a native DB type of :interval | |
| ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:interval] = { name: 'interval' } | |
| # add the interval type to the simplified_type list. because this method is a case statement | |
| # we can't inject anything into it, so we create an alias around it so calls to it will call |
| # In spec_helper: | |
| # RSpec.configure do |config| | |
| # ... | |
| # config.include(MockGeocoder) | |
| # end | |
| # | |
| # In your tests: | |
| # it 'mock geocoding' do | |
| # # You may pass additional params to override defaults | |
| # # (i.e. :coordinates => [10, 20]) |
Follow the steps below to setup a local development environment:
Recommended to download latest XQuartz
| gem 'devise' | |
| gem 'omniauth-facebook' |
This guide assumes that you recently run brew upgrade postgresql and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.
First let's check something.
brew info postgresqlThe top of what gets printed as a result is the most important:
| gem install puma -- --with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib |
If you don't have homebrew installed - get homebrew here
Then run: brew install elasticsearch
Update the elasticsearch configuration file in /usr/local/etc/elasticsearch/elasticsearch.yml.
| module Authenticable | |
| # Devise methods overwrite | |
| def current_user | |
| @current_user ||= User.find_by(authentication_token: request.headers['Authorization']) | |
| end | |
| def authenticate_with_token! | |
| render json: { errors: "Not authenticated" }, | |
| status: :unauthorized unless user_signed_in? |
If you start to see something like this, e.g. on Heroku since they installed the postgres 9.5 client libraries on their dynos
/usr/lib/postgresql/9.5/bin/pg_dump: invalid option -- 'i'
Try "pg_dump --help" for more information.
rake aborted!
Error dumping database
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.4/lib/active_record/tasks/postgresql_database_tasks.rb:55:in `structure_dump'