To Examples

PageWithImage Directions

 

  1. Open a command window.
     
  2. Navigate to your rails applications folder.
     
  3. Create a new rails project named PageWithImage:
    > rails new PageWithImage
     
  4. Navigate to the PageWithImage folder.
     
  5. Create a new rails controller and view:
    > rails generate controller ShowImage mypage
    or
    > rails g controller ShowImage mypage
     
  6. Copy this image to the folder
    PageWithImage/app/assets/images
     
  7. Replace the contents of the file PageWithImage/app/views/show_image/mypage.html.erb with
    mypage.html.erb
     
  8. Start the Rails server:
    > rails server
    or
    > rails s
     
  9. In a browser navigage to this URL:
    > http://localhost:3000/show_image/mypage