$ rails g model User
belongs_to
has_one
| - Check rails version | |
| $ rails -v | |
| - To update rails | |
| $ gem update rails | |
| - Creating a new rails app using postgresql | |
| $ mkdir rails_projects | |
| $ cd rails_projects | |
| $ rails new myapp --database=postgresql |
| # | |
| # Install the MYSQL driver | |
| # gem install mysql2 | |
| # | |
| # Ensure the MySQL gem is defined in your Gemfile | |
| # gem 'mysql2' | |
| # | |
| # And be sure to use new-style password hashing: | |
| # http://dev.mysql.com/doc/refman/5.0/en/old-client.html | |
| development: |
Command Line
pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb - load your rails into a pry sessionDebugger
Cheat Sheets are greate but they are not a substitute for learning the framework and reading the documentation as we most certainly have not covered every potential example here. Please refer to the Rails Command Line Docs for more information.
You can get all of this information on the command line.
rails generate with no generator name will output a list of all available generators and some information about global options.
rails generate GENERATOR --help will list the options that can be passed to the specified generator.
Open terminal and run the follow command to install the latest version of Homebrew. This will also install the XCode utils if you don't have them already installed.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
initialize: once, when the controller is first instantiatedconnect: anytime the controller is connected to the DOM| <div id="wrapper"> | |
| <form id="paper" method="get" action=""> | |
| <div id="margin">Title: <input id="title" type="text" name="title"></div> | |
| <textarea placeholder="Enter something funny." id="text" name="text" rows="4" style="overflow: hidden; word-wrap: break-word; resize: none; height: 160px; "></textarea> | |
| <br> | |
| <input id="button" type="submit" value="Create"> | |
| </form> | |
| </div> |
By Ira Herman
Live Video Walkthrough (bonus lesson) recording
================