slides: http://cherimarie.github.io/gdi-rails
Girl Develop It is here to provide affordable and accessible programs to learn software through mentorship and hands-on instruction.
Some "rules"
Gems are ruby libraries or programs. They're simultaneously the best and worst thing about Rails.
You can add all sorts of amazing functionality to your app with very little effort via a gem, but then you have to deal with versioning and conflicts between gems.
Gems are specified in your app's Gemfile. Running 'bundle install' ensures you have all gems available locally, and updates your Gemfile.lock file.
It is very common to break up your Gemfile into groups that correspond to Rails environments: test, development, production.
We are going to follow the documentation's instructions, as it is well maintained and accurate.
As of this writing, steps for Devise setup are:
Tool check!
$ heroku --help
$ git --help
If you don't get help menus back, get a TA to help you install Heroku and Git correctly.
Let's follow Railsbridge's instructions.
There is one correction- step 4 on the next slide.
As of this writing, steps to deploy to Heroku are:
production:
adapter: postgresql
database: db/production
In db/seeds.rb, you can write code that will populate the database. Syntax is exactly like the Rails Console, so it should look familiar to you.
Whenever the app is setup on a new machine (your collaborator's, Heroku's servers, etc), 'rake db:seed' can be run, and the database will be populated with the data from seed file. Sweet!
In my db/seeds.rb file, I added this:
Artist.create(name: "Shonen Knife", hometown: "Osaka")
Artist.create(name: "Shakira", hometown: "Barranquilla")
Artist.create(name: "Beyonce", hometown: "Houston")
Artist.create(name: "Teagan and Sara", hometown: "Calgary")
After saving db/seeds.rb, in the terminal run:
$ rake db:seed
After pushing your changes to Heroku, in the terminal run:
$ heroku run rake db:seed
Ruby-doc.org | Official Ruby documentation |
Ruby on Rails Guides | Excellent documentation for Rails |
Rails Casts | Screencasts on how to do almost everything with Rails |
The Rails Tutorial | Great free (HTML version) book with step-by-step instructions on building Rails apps |
RubyGems.org | Listing of all available Gems |
Ruby the Hard Way | Fun, free (HTML version) book with great information about programming |
Girl Develop It | Local workshops, events, and coding sessions with awesome people <3 |