Add the following code in nginx.conf, inside http block
upstream rails {
# Path to Unicorn socket file
server unix:/home/username/project_name/shared/sockets/uni$
}
#!/bin/bash | |
echo "Setting up RoR and MySQL environment" | |
echo "Updating repositories..." | |
if ! sudo apt-get update | |
then | |
echo "Can't update the repository." | |
exit 1 |
$(document).ready(() => { | |
initializeTypeahead('/materias/buscar', '/materias', '#subject_study_plan') | |
}); | |
function initializeTypeahead(remote_url, prefetch_url, selector) { | |
var subjects = new Bloodhound({ | |
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'), | |
queryTokenizer: Bloodhound.tokenizers.whitespace, |
# activerecord-3.0.0/lib/active_record/connection_adapters/mysql_adapter.rb | |
# Maps logical Rails types to MySQL-specific data types. | |
def type_to_sql(type, limit = nil, precision = nil, scale = nil) | |
return super unless type.to_s == 'integer' | |
case limit | |
when 1; 'tinyint' | |
when 2; 'smallint' | |
when 3; 'mediumint' | |
when nil, 4, 11; 'int(11)' # compatibility with MySQL default |
List of useful Game designing tools - https://forum.unity.com/threads/list-of-useful-game-designing-tools.275202/ |
https://www.codecademy.com/pt-BR/articles/deploy-rails-to-heroku |
class ApplicationController < ActionController::Base | |
before_action :validate_session | |
def validate_session | |
if session[:user].nil? | |
redirect_to new_session_path if controller_name != 'sessions' | |
else | |
redirect_to home_index_path if controller_name == 'sessions' && action_name != 'destroy' | |
end | |
end |
FROM ruby:2.6 | |
RUN apt-get update -qq && apt-get install -y nodejs | |
RUN mkdir /app | |
WORKDIR /app | |
COPY Gemfile /app/Gemfile | |
COPY Gemfile.lock /app/Gemfile.lock |
FROM ruby:2.5 | |
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client | |
RUN mkdir /app | |
WORKDIR /app | |
COPY Gemfile /app/Gemfile | |
COPY Gemfile.lock /app/Gemfile.lock |