tag:blogger.com,1999:blog-43196640450177913082024-02-18T22:19:29.995-08:00techiehatRaluhttp://www.blogger.com/profile/04545164654912480275noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-4319664045017791308.post-26675313159158876252010-05-05T11:23:00.000-07:002010-05-05T12:22:57.891-07:00starting with Instant Rails<div style="text-align: center;"><span class="Apple-style-span" style="font-family: 'trebuchet ms'; ">The easiest way to get started with ROR on Windows is to use Instant Rails. Instant Rails, is a one-stop Rails runtime solution containing Ruby, Rails, Apache, and MySQL, all preconfigured and ready to run.There is no installer, you simply unzip it into the directory of your choice and run it.</span></div><span class="Apple-style-span" style="font-family:'trebuchet ms';"><span class="Apple-style-span" style="font-size:small;">The Instant Rails can be downloaded from </span></span><a href="http://rubyforge.org/frs/?group_id=904"><span class="Apple-style-span" style="font-family:'trebuchet ms';"><span class="Apple-style-span" style="font-size:small;">http://rubyforge.org/frs/?group_id=904</span></span></a><span class="Apple-style-span" style="font-family:'trebuchet ms';"><span class="Apple-style-span" style="font-size:small;"><br /><br />after that follow these steps...</span></span><span class="Apple-style-span" style="font-family:'trebuchet ms';"><span class="Apple-style-span" style="font-size:small;">Unzip Instant Rails where you want it to reside. I chose C:\InstantRails</span></span><ul><li><span class="Apple-style-span" style="font-family:'trebuchet ms';"><span class="Apple-style-span" style="font-family:Tahoma, Arial;"><span class="Apple-style-span" style="font-size:small;">Make sure that the installation path (to the directory into which you unzip the archive) does not contain any space characters, and then start </span><span class="docEmphasis"><span class="Apple-style-span" style="font-size:small;">InstantRails.exe</span></span><span class="Apple-style-span" style="font-size:small;">.</span></span></span></li><li><span class="Apple-style-span" style="line-height: 18px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><span class="Apple-style-span" style="font-family:'trebuchet ms';"><span class="Apple-style-span" style="font-size:small;">Start Instant Rails. Click the "OK" button to let it update the configuration file</span></span></span></li></ul><span class="Apple-style-span" style="font-family:Tahoma, Arial;"><span class="Apple-style-span" style="font-size:small;">That's all there is to it!</span></span><div><span class="Apple-style-span" style="font-family:Tahoma, Arial;"><span class="Apple-style-span" style="font-size:small;"> </span></span></div><div><span class="Apple-style-span" style="font-family:Tahoma, Arial;"><span class="Apple-style-span" style="font-size:small;">so u will get a window like this when u double click instantrails.exe</span></span></div><div><span class="Apple-style-span" style="font-family:Tahoma, Arial;"><span class="Apple-style-span" style="font-size:small;"><br /></span></span></div><div><span class="Apple-style-span" style="font-size:small;"><span class="Apple-style-span" style="font-family:Tahoma, Arial;"></span></span><div><div><span class="Apple-style-span" style="font-family:Tahoma, Arial;"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpeAeiv4JVwGW112bjDNoAgLly_-LvKsA6wL7D8i1l_V-0Nqn7tzMAVSNpiaeMxE8rtqqbNgG3Jdx51SUc4RsiGZESnGsFD4jUowCl7pxT0VaL-gRc9hyV0UO0hanNJoXIYCd0xC1xkxE/s320/InstantRails.png" style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 135px;" border="0" alt="" id="BLOGGER_PHOTO_ID_5467865652112702690" /></span></div><div><span class="Apple-style-span" style="font-family:Tahoma, Arial;"><span class="Apple-style-span" style="font-size:small;">if you have a made a rails app , just copy paste to rails_apps in c:\</span></span><span class="Apple-style-span" style=" ;font-family:'trebuchet ms';"><span class="Apple-style-span" style="font-size:small;">InstantRails </span></span></div></div></div><div><span class="Apple-style-span" style="font-family:'trebuchet ms';"><div><span class="Apple-style-span" style="font-size:small;">To the left of the Apache button, there is a button that has the Instant Rails logo. Clicking this button reveals</span></div><div><span class="Apple-style-span" style="font-size:small;">a drop-down menu with the following options:</span></div><div><span class="Apple-style-span" style="font-size:small;">• Help</span></div><div><span class="Apple-style-span" style="font-size:small;">• Log Files</span></div><div><span class="Apple-style-span" style="font-size:small;">• Configure</span></div><div><span class="Apple-style-span" style="font-size:small;">• Rails Applications</span></div><div><span class="Apple-style-span" style="font-size:small;">• Restart Servers</span></div><div><span class="Apple-style-span" style="font-size:small;">• Stop Servers and Exit</span></div><div><span class="Apple-style-span" style="font-size:small;"><br /></span></div><div><span class="Apple-style-span" style="font-size:small;">in that click rails_application , a new window opens , showing your rails_app in that.</span></div><div><span class="Apple-style-span" style="font-size:small;">'check' your rails_app and click 'start with mongrel'</span></div><div><span class="Apple-style-span" style="font-size:small;">console opens showing your application has started..</span></div><div><span class="Apple-style-span" style="font-size:small;">so open a browser and go with http://localhost:3000.. now you can start with your project</span></div></span></div>Raluhttp://www.blogger.com/profile/04545164654912480275noreply@blogger.com0tag:blogger.com,1999:blog-4319664045017791308.post-36157675698841270172010-05-04T01:32:00.000-07:002010-05-04T02:03:17.369-07:00xml generation using railshi all...<br />Here is how to do this:<br /><br />create rails app<br /><code><br />>> rails xml_generation -d mysql<br /></code><br />create the database which u want to use and edit the name in database.yml<br />now create the model for 'xml_generation'<br /><code><br />xml_generation>>ruby script/generate model student<br /></code><br />edit the migration file created,<br /><code><br />class CreateStudents < ActiveRecord::Migration<br />  def self.up<br />    create_table :students do |t|<br />      t.string :first_name<br />      t.string :last_name<br />      t.integer :age<br />      t.string :school_name<br />      t.timestamps<br />    end<br />    Student.create(<br />      :first_name => 'Monica',<br />      :last_name => 'Geller',<br />      :age  => 20,<br />      :school_name => 'Bhavans'<br />    )<br />  end<br />  def self.down<br />    drop_table :students<br />  end<br />end<br /></code><br />so now we need to generate the controller,<br /><code><br />xml_generation>>ruby script/generate controller student<br /></code><br />after that edit the controller with these codes,<br /><code><br />class StudentController < ApplicationController<br />  def create_file<br />    @students = Student.find(:all)<br />    file = File.new('dir.xml','w')<br />    doc = REXML::Document.new<br />    make = REXML::Element.new "make"<br />    @students.each do |s|<br />      first_name_node = make.add_element "FirstName"<br />      first_name_node.text  = s.first_name<br />      last_name_node = make.add_element "LastName"<br />      last_name_node.text  = s.last_name<br />      age_node = make.add_element "Age"<br />      age_node.text  = s.age<br />      school_node = make.add_element "School"<br />      school_node.text  = s.school_name<br />    end<br />    doc.add_element make<br />    file.puts doc<br />    file.close<br />  end<br />  <br />end<br /></code><br />migrate the project<br /><code><br />xml_generation>> rake db:migrate<br /></code><br /><br />time to run it <br /><code><br />xml_generation>>ruby script/server<br /></code><br /><br />open a browser and goto to http://localhost:3000/student/create_file<br /><br />enjoy....!Raluhttp://www.blogger.com/profile/04545164654912480275noreply@blogger.com0