Thursday, December 16, 2010

RAILS 3

Rails is a web based framework it running on the top of the ruby....the developer need not worry about the code its simple and easy to create
the web based applications

Rails components

              1) Action pack
                     a)Action Controller
                     b)Action Dispatch
                     c)Action View
             
              2)Action Mailer
            
              3)Active Model
             
              4) Active Record
           
              5)Active Resource
          
              6)Active Support
   
              7)Railties


MVC:---Model , View and Controller
 
          what it does ?

               M----> the part of the application it interacts with DBMS(oracle,mysql,postgresql,sqlite,sybase,informix,etc..)
                      persistent data is accessed 
              
               V---->view is the part of the application it paints and designs the screen it shows the output of how we look and feel
                     of the design

               C---->controller it acts as an interface between the model and view it acts as a bridge between by controlling the model
                     and viewing the application

REST based architecture

                  REST means Representational State Transfer architecture it is the new method of the architecture we accesing the elements

                  through the URI(Uniform Resource Identifier) or URL(Uniform Resource Locator) through this method we can access the files

                  through direct URL 

                      FOR example http://localhost:3000/posts.xml  it displays the xml format of our data

                                  http://localhost:3000/posts.html it displays the html format of our data

          
To create a new project in Rails

                               rails new myblog
                               
                               we telling this command to rails starting new project using the keyword new the project name is myblog

                               it creates the directory called myblog

                               we can see all the switches using the rails-h command

                               cd myblog --change directory to myblog

                   student@student:~$ cd myblog

                   student@student:~/myblog$ ls

                        app     config.ru  doc      lib  public    README  test  vendor
                        config  db         Gemfile  log  Rakefile  script  tmp

        in the README file it contains the basic documentaion file
       
         student@student:~/myblog/app$ ls
 
         controllers  helpers  mailers  models  views

         controllers:The program files making up the application itself
                     Where you store all controllers  
                                 
              Models:Where you store all models  

               Views:Where you store all views

             Layouts:Where you store layouts to make "look and feel" uniform
                     Where Rails configuration is stored

         student@student:~/myblog$ cd config
        
         student@student:~/myblog/config$ ls

            application.rb  database.yml    environments  locales
            boot.rb         environment.rb  initializers  routes.rb

              Config: Info to connect to the database.

        student@student:~/myblog/config$ ls

            application.rb  database.yml    environments  locales
            boot.rb         environment.rb  initializers  routes.rb

        student@student:~/myblog/config$ cat routes.rb
  
              routes.rb :Determines the URL to access the application 
       

No comments:

Post a Comment