Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Marina Petrova

Rails Girls Munich
October 13, 2012
590

Marina Petrova

From Zero to Deploy. Presentation to Rails Girls Munich (Okt 2012)

Rails Girls Munich

October 13, 2012
Tweet

Transcript

  1. Step 1: App’s creation mkdir projects cd projects rails new

    railsgirls cd railsgirls Samstag, 13. Oktober 12
  2. Step 2: Generating MVC for app rails generate scaffold idea

    name:string description:text picture:string Samstag, 13. Oktober 12
  3. Step 2: Generating MVC for app rails generate scaffold idea

    name:string description:text picture:string Samstag, 13. Oktober 12
  4. Step 2: Generating MVC for app So we can list,

    add, remove, edit & view ideas Samstag, 13. Oktober 12
  5. Step 2: Generating MVC for app HTTP request URL Action

    Purpose GET /ideas index page to list all ideas GET /ideas/1 show page to show idea with id 1 GET /ideas/new new page to make a new idea POST /ideas create create a new idea GET /ideas/1/edit edit page to edit idea with id 1 PUT /ideas/1 update update idea with id 1 DELETE /ideas1 destroy delete idea with id 1 ideas_controller.rb Samstag, 13. Oktober 12
  6. Step 5: Uploading pictures mount_uploader :picture, PictureUploader app/models/idea.rb app/views/ideas/_form.html.erb <%=

    form_for(@idea) do |f| %> <%= form_for(@idea, :html => { :multipart => true }) do |f| %> Samstag, 13. Oktober 12
  7. Step 5: Uploading pictures app/views/ideas/show.html.erb <%= image_tag(@idea.picture_url, :width => 600)

    if @idea.picture.present? %> text representation -> image representation Samstag, 13. Oktober 12
  8. Step 7: Deployment group :development do gem 'sqlite3' end group

    :production do gem 'pg' end gem 'sqlite3' bundle install --without production Samstag, 13. Oktober 12
  9. Step 7: Deployment git init git add . git commit

    -m "initial commit" Samstag, 13. Oktober 12
  10. Step 7: Deployment heroku create git push heroku master heroku

    run rake db:migrate heroku open Samstag, 13. Oktober 12