If you have to extend an existing object with additional property, always prefer Vue.set() over Object.assign() (or spread operator).
Example below explains implications for different implementations.
| // config/webpack/environment.js | |
| const { environment } = require('@rails/webpacker') | |
| const vue = require('./loaders/vue') | |
| environment.loaders.append('vue', vue) | |
| const resolver = { | |
| resolve: { | |
| alias: { |
I've been following this blog post on how to set up an api-only Rails 5 application. One of the sections talks about creating a subdomain for your api
Rails.application.routes.draw do
constraints subdomain: "api" do
scope module: "api" do| var app = express(); | |
| app.io = require('socket.io')(); | |
| var routes = require('./routes/index')(app.io); | |
| app.use('/', routes); |
| # 1) Create your private key (any password will do, we remove it below) | |
| $ cd ~/.ssh | |
| $ openssl genrsa -des3 -out server.orig.key 2048 | |
| # 2) Remove the password | |
| $ openssl rsa -in server.orig.key -out server.key |
| # to generate your dhparam.pem file, run in the terminal | |
| openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
| #Overrides the default way how rails marks form fields with errors. | |
| #In this version, it only adds the class 'error' to label and element | |
| ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| | |
| if html_tag =~ /<(input|label|textarea|select)/ | |
| html_field = Nokogiri::HTML::DocumentFragment.parse(html_tag) | |
| html_field.children.add_class 'error' | |
| html_field.to_s | |
| else | |
| html_tag |
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |