$ rails g model User
belongs_to
has_one
<!doctype html> | |
<title>Site Maintenance</title> | |
<style> | |
body { text-align: center; padding: 150px; } | |
h1 { font-size: 50px; } | |
body { font: 20px Helvetica, sans-serif; color: #333; } | |
article { display: block; text-align: left; width: 650px; margin: 0 auto; } | |
a { color: #dc8100; text-decoration: none; } | |
a:hover { color: #333; text-decoration: none; } | |
</style> |
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', :github => 'rails/rails' | |
gem 'sqlite3' | |
GEMFILE | |
system 'bundle' | |
end |
## | |
# The MIT License (MIT) | |
# | |
# Copyright (c) 2014 Ryan Morrissey | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is |
Rails' use of strict naming conventions means a lot of core code SHOULD be in the same format whoever writes it? It could be written by a friend, colleague or a computer... it shouldn't matter because the same Rails rules apply to everyone.
This means that Rails can actually do some tasks for you! It can actually build things and write code on your behalf...
Coming from another language like PHP, this can seem like magic.
Rails promotes "convention over configuration". The convention provides a good baseline to start, but almost all apps must deviate in some large or small fashion, especially when it comes to config/environments/*.rb
. This is even true between different environments. By default development and production have different configuration.
Many developers become accustomed to "what works" in one environment and do not try their code in a production environment until they actually deploy to production. This leads to a very confusing series of debugging steps, starting with "I don't understand...it works locally", and ending in "what is different". This is a problem, it leaves developers with a broken production application, a demoralizing, and unclear problem to solve as well as no easy way to actually see "what is different".
To make matters worse, different configuration can do different things between Rails versions see (https://github.com/rails/rails/comm