[SOLVED] database WDE-Slides-14.pptx

$25

File Name: database_WDE-Slides-14.pptx.zip
File Size: 254.34 KB

5/5 - (1 vote)

WDE-Slides-14.pptx

Web System Development with
Ruby on Rails

Day 14(12/Jan/2017)

Summary and Hints for
Ruby on Rails Projects

Todays theme
We have learnt almost all the basic features

of Ruby on Rails up to the last week.
So, today, we summarize the hints of

generating the new project of Ruby on
Rails.Also we trouble-shoot the final
project of My Twitter or My Memopad to
prepare for the presentation!

Also, (as we restarted for picture uploading,)
complete the sample My Twitter.

Master table features
We have introduced category for memos.
We classified memos using category.

In case we generate shopping site, we may have

several types of users.
System administrator
Shop clerks
Customer, and such.

We can register those user types using the same
method of category.

Master tables
Master tables are seldom updated with its

registered information. Those tables are
used to register such as;

Accounting code,
Division code (in the organization,)
Branch number of shops.

What else, do you think master tables are

best suited for?

Other than master tables
Scaffolding is too heavy for non-master

data.Scaffolding generate edit and
destroy, show links and views
automatically.

For tweets in the twitter site, shopping carts
for the web shopping site, we may need to
design the special views for those
information.

About Scaffolding
We have learnt two method of creating the

data model.One approach is to scaffold
the model.The other way is to generate a
model and the controller/view separately.

As for the master tables, scaffolding seems
to make things easier.

As for the transaction tables, generate the
controller separately seems to be suited.

Can you explain the reason why?

User modes
During the Autumn semester, for this

introductory course of Ruby on Rails, we
did not handle user modes.

Some web system, the system may
distinguish the login users, such as

administrator, (admin)
shop clerks / customer,
teachers / students
We should concerns those differences well

when we design views.

Model design
When we design the system data model, we

need to listen to the clients request
thoroughly.

Scrutinize the request, and pick up the
information data types, and list them up.

And make a group of some data pieces, to
design the Class / data model.

For Twitter, how did you design the data

pieces?

Relation Type and Entity Type
p Relation : is a relation and/or a Table

p There are two types of relations(tables), both
called Relation which means;
p Entity, or
p Relation

p Entity
p Real world object ( not physical sometimes)

p Relation
p Relation between two entities

Day 6 Slides

What is Entity?

l Entity Type:
l physically exists in the real world;

– students, teachers, lecture rooms, pizza(menu)

l is identical in the real world;
– University, subjects, flights, club teams
– They cannot be seen or even touched.

l Identical Entity
l University Buildings physically exists, but the

organization university does not necessarily
require the buildings.

Day 6 Slides

What is relation type

l Relation Type
l Represents the relation between two entities

– Enrollment: Students Enroll in subjects
– Order: Customers Order pizza
– Reservation: Customers reserve flights
– Rental: Customers rent DVD

l One customer can rent many DVDs
l One customer can order many pizza
l One student can enroll in many subjects

Day 6 Slides

Normalization
When you design the relational database

application, think about the normalization.

This is the must to keep information tidy.

Can you explain how Normalization helps

us to maintain the database tidy?

Frequent Questions about ID
In Ruby on Rails environment, ID (Identifier,

the primary key) for tables are generated
automatically, given the unique number
automatically, (incrementally for default
operation,) so we do not have to give IDs
for tables.

For relational links, [Table Name]_id should
be the relational pointer. When we use
this name, relational lookups are available
only with specifying belongs_toand
such declarations.

Screen design
Major two points
What kind of inputs do the system require?

What items the system can provide to the

users?

If you can answer to the above two

questions, you have completed the screen
design almost half.

Controller and Action / html
When you design the system, you may start

with models and views.

Think about the screen transition well. Think

good about the data packet which are sent
from the browsers, and the data packet to
the browsers.

Routing
In ruby on rails, you will find this table in

the config/routes.rb file.

When you design the input forms in the

application, please think about the
differences between PUT and POST
method.

Now, what are the differences between PUT

and POST?

Now complete My Twitter

Confirm what we had finished.
1) Tweet, and show our tweets (Chirps)
2)Upload photos for tweets, and register

face picture of ourselves.
3) Login authentication
4) Follow friends, and show tweets of the

followed friends.

Additional explanation for devise
We have introduced devise for user

authentication.
rails generate devise user
After this command, we can use current_user

global property, and the method
authenticate_user!

When we use guest model for devise by
rails generate devise guest
we will have current_guest, and

autheticate_guest! method.
My material had missed this point.

What shall we do to complete this?
1) Divide screen, to provide top banner,

menu_bar, footer, and right bar.
2)Give links to follow friends, edit

yourself, and edit password in the
menu_bar.

3) Prevent editing our friends tweets
4) Twitter-like layout

Screen division
Modify
app/views/layouts/application.html.erb
app/assets/stylesheets/scaffold.scss
and such, to add partial rendering.
See P42-49 of Day 4 slides, for

application.html.erb
See P39 of Day 4 slides and P4 of Day 4

slides, for scaffold.scss.

views/layouts/application.html.erb

app/helpers/application_helper.rb

app/views/shared/_menu_bar.html.erb

Shared/_right_bar.html,erb,
_footer.html.erb

app/assets/stylesheets/scaffold.scss

John

1

Split screen

Follow friends links
Link to the friends follow table is

follows_list_path, as is shown in the
routing table.

By typing rake routes command to check
the routing table. Add this link in
_menu_bar.

Menu Control
Provide different Top bar menu, for the

person who had logged in, and the person
who has not logged in yet.

Program as;
<% if current_user menu_items = [ ]else menu_items = [ … ]end %>

Error Trap
When you add upload Face link, be careful

about the nested Form

Form Nest

Twitter-like layout
1) Remove headings;
2) Show Handle name
3) Show formatted tweeted time,
4) Change layout

Chirps/index.html.erb of my case (1)

Chirps/index.html.erb of my case (2)

Final View

Complete your own WEB system!
This is all for today, and the last lecture

slides.

Take your time to install your own WEB

system, personal memo-pad or mini
twitter site of your own.

If you face with some troubles, send me a
mail together with zipped project folder.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] database WDE-Slides-14.pptx
$25