All code is available in example app - https://github.com/maxivak/webpacker-rails-example-app
class CreateNoIdModels < ActiveRecord::Migration | |
def change | |
create_table :no_id_models, id: false do |t| | |
t.integer :pk1 | |
t.integer :pk2 | |
end | |
end | |
end |
This gist will collects all issues we solved with Rails 5.2 and Webpacker
# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new <project_name> --webpack=stimulus --database=postgresql --skip-coffee --skip-test
set daemon 20 | |
set logfile syslog facility log_daemon | |
set mailserver smtp.gmail.com port 587 | |
username "ERROR-EMAIL-ADDRESS" password "PASSWORD" | |
using tlsv1 | |
with timeout 30 seconds | |
set alert ERROR-EMAIL-ADDRESS | |
set httpd port 2812 and |
This guide explains the way to setup a production server using Capistrano.
- Capistrano is a development gem which assist the developer to run commands on the production server (something like a Heroku toolbelt)
- Hence, it is installed and configured on developer's computer
# Gemfile
# Use Capistrano for deployment
### | |
# helper_name:inspect_helper | |
# author: Whien_Liou | |
# time: 2014/07/23 | |
# | |
# usage | |
# 請在增加 config/initializers/inspect_helper.rb | |
# 加入下列幾行代碼 | |
# 在 controller 使用 | |
# |
- 使用者可以登入 / 登出
- 使用者可以使用 Facebook 登入 https://github.com/xdite/auto-facebook
source :rubygems | |
# Turbolinks and jQuery.turbolinks without Rails dependencies | |
gem 'turbolinks', :git => 'git://github.com/ronny/turbolinks.git', :branch => 'lite' | |
gem 'jquery-turbolinks', :git => 'git://github.com/ronny/jquery.turbolinks.git', :branch => 'lite' |
class Link < ActiveRecord::Base | |
scope :recent, order("id DESC") | |
belongs_to :post | |
belongs_to :user | |
belongs_to :group | |
I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.
If you want to roll up all of these into a single jQuery plugin check out Sharrre
Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.