The Security requirements have been captured and defined in the MS Excel Security matrix, and it is my job to "execute" those requirements correctly so that Security is correct and Federal laws such as HIPAA and FERPAA are also complied....that means specifically that if one has "Viewer" only access, then he or she can only see the last 4-digits SSN for example.
I will go through that experience in more details in my next blogs but for now...I want to take you to ride the wonderful journey with Rails, the popular Web frameworks, and in the spirit of Superbowl 2010, develop a Web-based NFL team app using Ruby on Rails.
With backgrounds also heavy in Java, I count my blessings and am very excited with the JRuby on Rails.
With JRuby, you have the ability to incorporate the existing Java libraries and code-base that you have, but losing the native (C-compiled) Ruby libraries, also called Ruby gems.
So without further ado,....
Install JRuby
wget http://dist.codehaus.org/jruby/1.2.0/jruby-bin-1.2.0.tar.gztar xzvf jruby-bin*mv jruby-1.2.0 /cygdrive/c/jrubyecho "export PATH="/cygdrive/c/jruby/bin:$PATH"" >> ~/.bashrcexport PATH="/cygdrive/c/jruby/bin:$PATH"
Install Rails
jruby -S gem install rails
Now let us create our application by firing up rails....

Now, since we are working with JRuby, we need to modify the database backend by working with JDBC
So go and edit the config/database.yml file and change the adapter from sqlite3 to jdbcsqlite3 as follows:

In our application, each NFL team would have many players, whereas a player belongs to a team.
Next, use the scaffold facility that is available for both the team and the player model/entity.


Notice that for each singular entity, (team or player), the scaffold creates the plurals version.
team => table teams, teams_controllerplayer => table players, players_controller
You can verify this DRY, Do Not Repeat, principle by looking at the db/schema.rb

establishing the Associations between the Team and the Player entity is done as follows
in the model itself


create the DB tables by issuing the command
jruby -S rake db:migrate

What I often have to do is to populate those tables in the DB...You can fire up the Webrick or Mongrel Web server that Rails comes with and enter the data manually, after all the CRUD facility is there through scaffolding, or another option is to use the test fixtures



players.yml
allred:number: 56name: Allred, Colinposition: LBteam_id: 1amano:number: 54name: Amano, Eugeneposition: G/Cteam_id: 1amato:number: 58name: Amato, Kenposition: LB/LSteam_id: 1bakhtiari:number: 99name: Bakhtiari, Ericposition: DEteam_id: 1ball:number: 98name: Ball, Davidposition: DEteam_id: 1bironas:number: 2name: Bironas, Robposition: Kteam_id: 1britt:number: 18name: Britt, Kennyposition: WRteam_id: 1brown:number: 79name: Brown, Kareemposition: DLteam_id: 1brown:number: 97name: Brown, Tonyposition: DTteam_id: 1bulluck:number: 53name: Bulluck, Keithposition: OLBteam_id: 1collins:number: 5name: Collins, Kerryposition: QBteam_id: 1cook:number: 89name: Cook, Jaredposition: TEteam_id: 1
teams.yml
titans:id: 1name: Titanscity: Nashvillesport: footballraiders:id: 2name: Raiderscity: Oaklandsport: football
Load the fixtures into the DB through the following command
jruby -S rake db:fixtures:load
Fires up rails and starts riding the Rails experience ................
No comments:
Post a Comment