• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Datamodel in Ruby
 

Datamodel in Ruby

on

  • 5,278 views

A short presentation followed by a demo (not included) of the capabilities of Ruby on Rails for databases.

A short presentation followed by a demo (not included) of the capabilities of Ruby on Rails for databases.

Statistics

Views

Total Views
5,278
Views on SlideShare
5,239
Embed Views
39

Actions

Likes
4
Downloads
0
Comments
1

4 Embeds 39

http://www.slideshare.net 20
http://rubisobrerieles.blogspot.com 12
http://www.webxy.nl 4
http://www.planetacodigo.com 3

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • Exceptional slideshow. Very clear and helpful
    Sharika
    http://winkhealth.com http://financewink.com
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Datamodel in Ruby Datamodel in Ruby Presentation Transcript

    • Building your app (1)
      • Modeling the data
      Raymond van Dongelen | NHL | www.webxy.nl
    • Datamodel
      • Should prevent storing the same information twice
      • Should guard relations in the data
      • Should be able to cope with changing data structure
    • Contents
      • Datamodel
      • ActiveRecord
      • Sample application
    • Ruby and data
      • All database handling is done in the model
      • Powerful features to validate data, guard relations, search data.
      • All data is wrapped in Ruby classes
      • SQL is almost never needed
    • Ruby naming
      • Table name plural
      • Key in a table “id”
      • Reference to another table “table_id”
    • ActiveRecord(1)
      • Validators:
      • validates_presence_of
      • validates_uniqueness_of
      • Relations:
      • belongs_to
      • has_one
      • has_and_belongs_to_many
      • has_many
    • ActiveRecord(2)
      • Example:
      • class Agenda < ActiveRecord::Base
      • belongs_to :user
      • validates_presence_of :user, :message => &quot;cannot be empty&quot;
      • end
    • ActiveRecord (3)
      • @agenda = Agenda.find(1)
      • puts (@agenda.user.name)
      • <== We are able to display the user, it is automatically fetched
    • ActiveRecord (4)
      • Dynamic find
      • Agenda.find_all_name (“Home”)
      • User.find_all_by_email (“ [email_address] ”)
    • ActiveRecord (5)
      • Many many powerful features
      • Read chapter 14 agile web development with Ruby on Rails
    • Sample application User Project Task Subtask User can be in many projects Project can have many users A project has many tasks A task has many subtasks Sample can be found on http://www.webxy.nl/?p=63