Getting started with a rails 5.2 project
Hopefully your using Rbenv to manage ruby versions.
Install and create your app
rbenv install 2.3.1p112
gem install rails
Create your project
rails new practice_rails
Stand it up and browse to localhost:3000
cd practice_rails
rails server
Some house cleaning
Comment out coffee script from your Gemfile
, if you feel the way I do
```
gem 'coffee-rails', '~> 4.2'
```
Lets not generate assets or helpers by default. Add the following to config/application.rb
``` class Application < Rails::Application
# don't generate assets or helpers (add this)
config.generators do |generate|
generate.helper false
generate.assets false
end
end ```
Add a welcome page
Generate a welcome controller with a index method
rails g controller welcome index
And modify your config/routes.rb to point to it
root 'welcome#index'
Then browse localhost:3000 to see it in action
Style things a bit
Normalize
Let's style by using Normalize to css reset some bad browser behavior. Create a file app/assets/stylesheets/normalize.css
and copy the normalize code into it.
Make it pretty
Lets make things a tiny bit better with bourbon.
Add the following two lines to your Gemfile
gem 'bourbon'
gem 'bitters'
Install the gems and bourbon stylesheets
bundle install --path=vendor
bundle exec bourbon install --path app/assets/stylesheets/
Then install bitters to make it pretty & make application.css a sass file
cd app/assets/stylesheets && bundle exec bitters install
cd ../../../ && mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss
Add the directives to the app/assets/stylesheets/application.scss
file
@import "bourbon/bourbon"
@import "base/base"