{"id":58,"date":"2010-08-04T17:39:37","date_gmt":"2010-08-04T12:09:37","guid":{"rendered":"http:\/\/atuljha.com\/blog\/?p=58"},"modified":"2010-08-04T17:45:55","modified_gmt":"2010-08-04T12:15:55","slug":"ror-on-ubuntu-lucid","status":"publish","type":"post","link":"https:\/\/atuljha.com\/blog\/2010\/08\/04\/ror-on-ubuntu-lucid\/","title":{"rendered":"Running your first Ruby on rails application (hello world), on Ubuntu Lucid."},"content":{"rendered":"<p>1.Installing Ruby and Ruby on Rails.<\/p>\n<pre lang=\"bash\">\r\n$ sudo apt-get install ruby rails\r\n<\/pre>\n<p>2.Creating first application running on WEBrick server.<\/p>\n<pre lang=\"bash\">\r\n      $ rails test\r\n      create  \r\n      create  app\/controllers\r\n      create  app\/helpers\r\n      create  app\/models\r\n      create  app\/views\/layouts \r\n      create  config\/environments\r\n      create  config\/initializers\r\n      create  config\/locales\r\n      create  db\r\n      create  doc\r\n      create  lib\r\n      create  lib\/tasks\r\n      create  log\r\n      create  public\/images\r\n      create  public\/javascripts\r\n      create  public\/stylesheets\r\n      create  script\/performance\r\n      create  test\/fixtures\r\n      create  test\/functional\r\n      create  test\/integration\r\n      create  test\/performance\r\n      create  test\/unit\r\n      create  vendor\r\n      create  vendor\/plugins\r\n      create  tmp\/sessions\r\n      create  tmp\/sockets\r\n      create  tmp\/cache\r\n      create  tmp\/pids\r\n      create  Rakefile\r\n      create  README\r\n      create  app\/controllers\/application_controller.rb\r\n      create  app\/helpers\/application_helper.rb\r\n      create  config\/database.yml\r\n      create  config\/routes.rb\r\n      create  config\/locales\/en.yml\r\n      create  db\/seeds.rb\r\n      create  config\/initializers\/backtrace_silencers.rb\r\n      create  config\/initializers\/inflections.rb\r\n      create  config\/initializers\/mime_types.rb\r\n      create  config\/initializers\/new_rails_defaults.rb\r\n      create  config\/initializers\/session_store.rb\r\n      create  config\/initializers\/cookie_verification_secret.rb\r\n      create  config\/environment.rb\r\n      create  config\/boot.rb\r\n      create  config\/environments\/production.rb\r\n      create  config\/environments\/development.rb\r\n      create  config\/environments\/test.rb\r\n      create  script\/about\r\n      create  script\/console\r\n      create  script\/dbconsole\r\n      create  script\/destroy\r\n      create  script\/generate\r\n      create  script\/runner\r\n      create  script\/server\r\n      create  script\/plugin\r\n      create  script\/performance\/benchmarker\r\n      create  script\/performance\/profiler\r\n      create  test\/test_helper.rb\r\n      create  test\/performance\/browsing_test.rb\r\n      create  public\/404.html\r\n      create  public\/422.html\r\n      create  public\/500.html\r\n      create  public\/index.html\r\n      create  public\/favicon.ico\r\n      create  public\/robots.txt\r\n      create  public\/images\/rails.png\r\n      create  public\/javascripts\/prototype.js\r\n      create  public\/javascripts\/effects.js\r\n      create  public\/javascripts\/dragdrop.js\r\n      create  public\/javascripts\/controls.js\r\n      create  public\/javascripts\/application.js\r\n      create  doc\/README_FOR_APP\r\n      create  log\/server.log\r\n      create  log\/production.log\r\n      create  log\/development.log\r\n      create  log\/test.log\r\n<\/pre>\n<p>3.Configure WEBrick (Ruby&#8217;s server)<\/p>\n<pre lang=\"bash\">\r\n$cd test\r\n$ ruby script\/server\r\n\r\n=> Booting WEBrick\r\n=> Rails 2.3.8 application starting on http:\/\/0.0.0.0:3000\r\n=> Call with -d to detach\r\n=> Ctrl-C to shutdown server\r\n[2010-08-02 12:40:40] INFO  WEBrick 1.3.1\r\n[2010-08-02 12:40:40] INFO  ruby 1.8.7 (2010-01-10) [i486-linux]\r\n[2010-08-02 12:40:45] INFO  WEBrick::HTTPServer#start: pid=27681 port=3000\r\n<\/pre>\n<p>To test your ROR configure paste <a href=\" http:\/\/0.0.0.0:3000\">http:\/\/0.0.0.0:3000<\/a> on your browser.<\/p>\n<p>4.Creating a Controller, I call it hello.<\/p>\n<pre lang=\"bash\">\r\n$ ruby script\/generate controller hello\r\n      exists  app\/controllers\/\r\n      exists  app\/helpers\/\r\n      create  app\/views\/hello\r\n      exists  test\/functional\/\r\n      create  test\/unit\/helpers\/\r\n      create  app\/controllers\/hello_controller.rb\r\n      create  test\/functional\/hello_controller_test.rb\r\n      create  app\/helpers\/hello_helper.rb\r\n      create  test\/unit\/helpers\/hello_helper_test.rb\r\n\r\n<\/pre>\n<p>5.Creating an action, I call it hi.<\/p>\n<p>In the file app\/controllers\/hello_controller.rb, i have added action &#8220;hi&#8221;<\/p>\n<pre lang=\"bash\">\r\n\r\nclass HelloController < ApplicationController\r\n\r\n  def hi\r\n  end\r\n\r\nend\r\n\r\n<\/pre>\n<p>6.Creating view for the action \"hi\"<\/p>\n<pre lang=\"bash\">\r\n $ vim app\/views\/hello\/hi.html.erb\r\n\r\n<html>\r\n<body> Hello World!!<\/body>\r\n<\/html>\r\n\r\n<\/pre>\n<p>Lets test our page again.( Am sure the WEBrick server still running)<\/p>\n<p>on browser paste this --><a href=\" http:\/\/0.0.0.0:3000\/hello\/hi\"> http:\/\/0.0.0.0:3000\/hello\/hi<\/a> and you can see your first ROR application in front of you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.Installing Ruby and Ruby on Rails. $ sudo apt-get install ruby rails 2.Creating first application running on WEBrick server. $ rails test create create app\/controllers create app\/helpers create app\/models create app\/views\/layouts create config\/environments create config\/initializers create config\/locales create db create doc create lib create lib\/tasks create log create public\/images create public\/javascripts create public\/stylesheets create script\/performance &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/atuljha.com\/blog\/2010\/08\/04\/ror-on-ubuntu-lucid\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Running your first Ruby on rails application (hello world), on Ubuntu Lucid.&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,5],"tags":[206],"_links":{"self":[{"href":"https:\/\/atuljha.com\/blog\/wp-json\/wp\/v2\/posts\/58"}],"collection":[{"href":"https:\/\/atuljha.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atuljha.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atuljha.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atuljha.com\/blog\/wp-json\/wp\/v2\/comments?post=58"}],"version-history":[{"count":7,"href":"https:\/\/atuljha.com\/blog\/wp-json\/wp\/v2\/posts\/58\/revisions"}],"predecessor-version":[{"id":65,"href":"https:\/\/atuljha.com\/blog\/wp-json\/wp\/v2\/posts\/58\/revisions\/65"}],"wp:attachment":[{"href":"https:\/\/atuljha.com\/blog\/wp-json\/wp\/v2\/media?parent=58"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atuljha.com\/blog\/wp-json\/wp\/v2\/categories?post=58"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atuljha.com\/blog\/wp-json\/wp\/v2\/tags?post=58"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}