Much in common with http://www.snip2code.com/Snippet/159602/Using-Dokku-to-deploy-a-Rails-Applicatio
Initialize droplet via https://www.digitalocean.com/community/tutorials/how-to-use-the-dokku-one-click-digitalocean-image-to-run-a-ruby-on-rails-app
| module MyApp | |
| class Application < Rails::Application | |
| config.to_prepare do | |
| ActiveStorage::Attachment.include OrderedAttachments | |
| end | |
| end | |
| end |
| <!-- posts/_form.html.erb --> | |
| <%= simple_form_for @form do |f| %> | |
| <%= f.input :user_id %> | |
| <%= f.input :subject %> | |
| <%= f.input :content %> | |
| <%= f.submit %> | |
| <% end %> |
| class ApplicationSerializer | |
| attr_reader :object | |
| def initialize(object, options = {}) | |
| @object = object | |
| @options = options | |
| end | |
| def to_json | |
| JSON.generate(as_json) | |
| end |
| class SiteConstraint | |
| def matches?(request) | |
| request.subdomain != 'my' && request.domain != 'localhost' | |
| end | |
| end | |
| class AppConstraint | |
| def matches?(request) | |
| request.subdomain === 'my' || request.domain == 'localhost' | |
| end |
| # https://gist.github.com/wwalexander/febbc1ba76c8eafa9f94f5cb2573b34d | |
| # https://news.ycombinator.com/item?id=17235270 | |
| # | |
| # Make sure this is named config.ru | |
| # install the gem with | |
| # $ gem install rack | |
| # | |
| # Usage: rackup | |
| require 'rack' |
| file = File.read("test.gemfile") | |
| open_group = false | |
| default_groups = [:general] | |
| current_groups = default_groups | |
| gem_groups = {} | |
| gems = {} | |
| file.split("\n").each do |line| |
| class Contact < ActiveRecord::Base | |
| ... | |
| def after_create | |
| if Hook.hooks_exist?('new_contact', self) | |
| Resque.enqueue(Hook, self.class.name, self.id) | |
| # To trigger directly without Resque: Hook.trigger('new_contact', self) | |
| end | |
| end |
| # Path to Oh My Fish install. | |
| set -gx OMF_PATH /Users/augusts/.local/share/omf | |
| source $OMF_PATH/init.fish | |
| # Path to your oh-my-fish. | |
| set PATH /Applications/Postgres.app/Contents/Versions/9.4/bin $PATH | |
| set PATH ~/bin $PATH | |
| set PATH /usr/local/bin $PATH | |
| set -x RACK_ENV development | |
| set -x EDITOR atom |
| [{ | |
| "date": "2016-01-09", | |
| "winners": [16, 19, 32, 34, 57], | |
| "powerball": 13 | |
| }, { | |
| "date": "2016-01-06", | |
| "winners": [2, 11, 47, 62, 63], | |
| "powerball": 17 | |
| }, { | |
| "date": "2016-01-02", |