spec
|--- apis #do not put into controllers folder.
|--- your_api_test_spec.rb
|--- controllers
|--- models
|--- factories
|--- views
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react' | |
| import { Redirect } from 'react-router' | |
| export default class ContactForm extends Component { | |
| constructor () { | |
| super(); | |
| this.state = { | |
| fireRedirect: false | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM node:7.10-alpine | |
| RUN mkdir -p /opt/app | |
| WORKDIR /opt/app | |
| COPY ./package.json /opt/app | |
| RUN apk add --update --no-cache tini &&\ | |
| apk add --virtual .build-dependencies make gcc g++ python &&\ | |
| npm install --production &&\ |
This lets you set the preload headers for your assets, so that the browser can start fetching them before it begins parsing HTML.
The best way to safely and securely use local domains pointing to 127.0.0.1 is to edit your local settings (/etc/hosts) and add your own settings. Keep in mind if you want to use subdomains, you need to enter all variations.
Example:
# Adding bottom of your current file /etc/hosts
################# MY LOCAL DOMAINS
127.0.0.1 local.com admin.local.com
127.0.0.1 domain1.com$ > sudo mysql -uroot
mysql > SELECT User, Host FROM mysql.user;
mysql > DROP USER 'root'@'localhost';
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <% [:notice, :error, :alert].each do |level| %> | |
| <% unless flash[level].blank? %> | |
| <div data-alert="alert" class="alert alert-<%= flash_class(level) %> fade in"> | |
| <a class="close" data-dismiss="alert" href="#">×</a> | |
| <%= content_tag :p, flash[level] %> | |
| </div> | |
| <% end %> | |
| <% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source 'https://rubygems.org' | |
| # default gems here | |
| #--------------------------- | |
| # add paperclip and bootstrap | |
| gem "paperclip", "~> 4.1" | |
| gem 'bootstrap-sass', '~> 3.1.1' |
@object.errors.full_messages.first
@object.errors
@object.errors.values.flatten.compact
@object.errors.messages.map {|e| { key: e.first, value: e.second } }
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| irb(main):001:0> ActionController.constants.map { |ac| "ActionController::#{ac}" }.join(", ") |