Time Series Foundation Models - current state and future directions
Viridians on Rails
1. on Why Rails? How Rails? Please find latest version of the presentation at http://viridian.in/academic_platform
2.
3.
4.
5.
6.
7. LEARNING TO LEARN RAILS YOURSELF Rails is based on conventions. To start, you need to know the basics. But from then on, learning rails is all about self-experimenting, Googling and discovering new conventions / plugins / gems / open source APIs which solve or simplify your problems.
8.
9. Rails project Note: Gem is the ruby equivalent of Java jar. Plugin is nothing but an unpacked jar file. Gem code cannot be changed but plugin code can be changed.
10. Is my env. working fine? *Note: 127.0.0.1 is localhost by default in Windows
17. Ritvvij Parrikh http://viridian.in [email_address] http://groups.google.com/group/viridian_in Thank You! Create a Viridians account at http://my.viridian.in
Editor's Notes
Ramesh - Vista
Start -> Run -> cmd > cd C:
ubyonrails > use_ruby > cd C:
ubyonrails
ails_apps > rails project_name -d mysql <<project_name>>/ ..../app ......../controller -> A controller handles a web request from the user. ......../helpers -> Functions which help GUI mainly. ......../models -> Each file corresponds to a table in database. ......../views ............../layouts -> template of view files. ............../<controller_name> -> folder corresponding to each controller. ................../viewfiles.html.erb -> Run it through ruby interpreteur and generate html file. A view file corresponding to each function in a controller. ..../config ......../environments -> Holds 3 configuration files one each for production, test and development env. ......../initializers -> Constants. ......../environment file -> General configuration. ......../database.yml file -> Database connection configuration per environment (prod, test, dev). ......../routes file -> Routing of incoming web requests to appropriate code. ..../db ......../migrate -> Holds migration files to creata tables, upload data, upload test data, etc. (like SQL scripts) ......../seed ............../always -> yml files for reference data. ............../before_others -> Holds yml files needed to be run always first. ......../schema.rb -> Holds database table structures. Rails automatically creates it. Never manually change it. ......../seeds.rb -> ignore. ..../doc -> RubyDocs. Ignore not important ..../lib -> ignore ..../log -> ignore ..../public ......../images -> Holds pictures that are to be shown on website. ......../javascript -> Javascript. ......../stylesheets -> CSS. ..../private -> Does not come with rails but at Viridians we add this folder to store user images and files. The public folder is exposed and hence a security risk. ..../script -> Scripts to create, manage and launch various rails services. ..../test -> ignore ..../tmp -> ignore ..../vendor ......../plugins -> 3rd party Plugins used by the project. ......../gems -> Holds 3rd party gems which have been frozen. README-> ignore Rakefile-> ignore
Start MYSQL Server > cd project_name > ruby script/server => Booting Mongrel => Rails 2.3.2 application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server Go to browser and type http://localhost:3000/
> ruby scriptgenerate scaffold contact name:string weblink:string email:string password:string -> Creates contacts_controller with new, create, edit, update, delete, show, index methods. Contacts model and contacts view folder with new, edit, show, index view files. Links accessible are http://website.com/contacts/new http://website.com/contacts/edit/1 http://website.com/contacts/show/1 http://website.com/contacts/index > ruby scriptgenerate controller password -> Rails promotes creating restful design. Now considering, we need to create 3 functions, edit_password, forgot_password, create_random_password. Instead of adding them to contacts controller, create a dummy controller called passwords and dump these functions in the passwords controller. > ruby scriptgenerate model page name:string header_str:string -> Creates a model file alone / table. rake db:drop -> Drop database schema rake db:create -> Add database schema rake db:migrate RAILS_ENV=production VERSION=<<>> -> Create tables and upload datavalues based on db/migrations files > ruby script/server => Booting Mongrel => Rails 2.3.2 application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server
rake db:drop -> Drop database schema rake db:create -> Add database schema rake db:migrate RAILS_ENV=production VERSION=<<>> -> Create tables and upload datavalues based on db/migrations files > ruby script/server => Booting Mongrel => Rails 2.3.2 application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server
Sessions in Rails Sessions configuration at …configinitializerssession_store.rb ActionController::Base.session = { :key => '_blabla', :secret => ‘….‘} ActionController::Base.session_store = :active_record_store Store session in DB at …dbmigratecreate_tables.rb sessions table Some functions at …appcontrollersapplication_controller.rb current_user_session, current_user, require_user, require_no_user Methods in Models User Model Virtual attributes on object def name return first_name + last_name end Static Methods def self.randomize_username …. End Database queries User.find_by_first_name(‘Vikram’) User.all(:conditions => {:first_name => ‘Vikram’, :last_name => ‘Aditya’}, :order => “created_at DESC”) User.first(:conditions => {:first_name => ‘Vikram’})