All girlhacknight intro to rails

343 views

Published on

Talk I gave to Austin All Girl Hacknite. We installed rails and built the app step by step. We had alot of brand new to rails ladies and we had fun making this simple app

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
343
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

All girlhacknight intro to rails

  1. 1. Lets make arails appNola Stowe, @rubygeekdotcomwww.rubygeek.com
  2. 2. Install Ruby and Rails1. Go to http://railsinstaller.org/2. Download the installer for your operatingsystem3. Run the installerFind where it is installed and verify that you canrun a console/shell window.
  3. 3. Create an appThe App we will make will be a list of resourceswe can use to learn ruby.rails new learning_tree
  4. 4. Create a scaffoldScaffolding is used to make a controller, model andview. Its basic but its a nice way to start an app.cd learning_treerails g scaffold task name:string url:string description:textrails destroy scaffold task (will undo previous)Use singular version!!
  5. 5. Add a default routeedit config/routes.rbAdd:root :to => tasks#indexremove file: public/index.html
  6. 6. Migrate your databasesqlite is used by default, make it easy to startworking in rails right awayrake db:migrate
  7. 7. Run your apprails serverorrails s
  8. 8. Try your appOpen your browser and go to http://localhost:3000Rails default port is 3000
  9. 9. Ready to customizeLets change the task index to make the url alink <td><%= link_to(task.url, task.url) %></td>link_to ( name of the link, url of link )
  10. 10. Move delete link to showI dont like the delete link to be so easily edited,so I move it to the show page.<%= link_to Destroy, @task, method: :delete,data: { confirm: Are you sure? } %> |change task to @task to use the instancevariable
  11. 11. Other ideas?Can you think of some other things we canchange/add for this app?
  12. 12. Resourceshttp://blog.rubygeek.com/getting-startedhttp://www.railscast.comhttp://www.codeschool.comhttp://rubeque.com

×