Rails New Project Setup
To build apps and other things with Ruby on Rails, we need to setup some software and the developer environment for…guides.railsgirls.com
http://www.justinweiss.com/blog/2014/06/17/fast-consistent-setup-for-your-ruby-and-rails-projects/
probably need to try not using .rvm
You probably want to install Homebrew and then install ruby via Homebrew
check for .gemrc on the home directory (bundler looks for the .gemrc file under the home directory !!)
WORKFLOW for setting up a new rails project
ALERT! do not SUDO install rails!!! we should not have to use this!!
TESTS to RUN as you go through this process: cd out and back in rvm gemset list gem list look at Sequel Pro rails s and look at browser
> rails new your_new_folder — skip-bundle — quiet — database=postgresql
***or use another database if desired as in mysql (which corresponds with the mysql2 gem)
touch .ruby-version
sub .
add this into the .ruby-version file
2.2.0 (or choose your favorite version of ruby)
gem install rails
rails new .
config/database.yml adapter: mysql2 project_name_db_development project_name_db_test project_name_db_production
config/routes.rb update the root path to be ‘home#index’ update resources (routes) to be resources :name_of_controller nested routes are like this resources :name_of_controller do resources :next_controller do end end
add new gems to Gemfile such as ‘mysql2’ and ‘haml-rails’
bundle install
rake db:create
rails g controller home
rake routes
add a def index within app/home_controller.rb class HomeController<ApplicationController def index end end
touch app/views/home/index.html.erb
OR
touch app/views/home/index.html.haml
rails s and look at browser