When you work on a Rails project you want your .git repo to be in the root of your Rails App.
This is very important for hosting your app on Heroku.
Many of you have the following repo structure:
# A project folder, with a rails app inside of it.| #put $ echo $USER cgelinas in the terminal RIGHT AFTER putting this in your database.yml file! | |
| development: &defaults | |
| adapter: postgresql | |
| encoding: unicode | |
| pool: 5 | |
| host: localhost | |
| username: <%= `echo $USER`.chomp %> | |
| password: | |
| database: <%= File.basename(Rails.root) %>_development |
| group :development, :test do | |
| gem 'pry-rails' | |
| gem 'rspec' | |
| gem 'rspec-rails' | |
| gem 'guard' | |
| gem 'guard-rspec' | |
| gem 'guard-bundler', require: false | |
| gem 'terminal-notifier-guard' | |
| gem 'shoulda-matchers' | |
| end |
| ---------------------------------------------------------------------- | |
| #### Steps to create Rails App #### | |
| ---------------------------------------------------------------------- | |
| 1.) rails new app_name -d postgresql | |
| 'Jesse's way': rails g model Complaint descriptor:string address:string latitude:decimal longitude:decimal zip:integer | |
| 2.) database.yml → 'Phil's gist' | |
| - put in: echo $USER in the terminal right after to make sure it works. | |
| 3.) rake db:create | |
| 4.) Insert ‘gem’ gist for development: |
| # What about including `pry`, `rspec` or `guard`? | |
| # They're loaded automatically as dependencies | |
| group :development, :test do | |
| # Annotates ActiveRecord Models, routes and others based on the database schema | |
| gem "annotate" | |
| # generates entity relationship diagrams based on Active Record models | |
| # Postscript bugs may be fixed with: |
| --- HEROKU STEPS to SET UP: --- | |
| (Make sure you're all pushed/pulled on master before doing anything heroku) | |
| 1. git init | |
| 2. git add -A | |
| 3. git commit -m “blah, blah” | |
| 4. heroku create | |
| 5. To add heroku ENV keys/variables → (If there are any). |
| <% if flash[:msg] %> | |
| <%= flash[:msg] %> | |
| <% end %> | |
| ------------------------------- | |
| <%= link_to "Sign Up", new_user_path(@user) %> | |
| ------------------------------- | |
| edit.html.erb (hipchat history) | |
| <%= render 'form' %> | |
| ------------------------------- | |
| <%= form_for(@user) do |f| %> |
| group :development, :test do | |
| gem 'launchy' | |
| gem 'capybara' | |
| gem 'pry-rails' | |
| gem 'rails-erd' | |
| gem 'rspec-rails', '~> 3.0.0.beta' | |
| gem 'jasmine' | |
| gem 'shoulda-matchers' | |
| gem 'factory_girl_rails' | |
| gem 'rubocop' |
| # def log_before_doing() | |
| # puts "About to do stuff in a block." | |
| # yield | |
| # yield | |
| # end | |
| # log_before_doing() { puts "Doin' stuff in a block."} | |
| # def do_ten_times() | |
| # 10.times { yield } |
| --------------------------------------------------------------------- | |
| user.rb | |
| --------------------------------------------------------------------- | |
| # == Schema Information | |
| # Table name: users | |
| # | |
| # id :integer not null, primary key | |
| # name :string(255) | |
| # email :string(255) | |
| # password_digest :string(255) |