Develop a ror application that shows the current time

Assignment Help Web Project
Reference no: EM131143706

Advanced Web Development - AJAX Lab

Aim: The aim of this lab is to understand how to implement AJAX in Rails applications

Instructions:

1. Use the VM supplied in class for this. Please refrain from using your own installs for labs.

2. Please answer all questions - you can be very brief. 

3. You may have to refer to the book/slides to understand some things.

1. Develop a RoR application that shows the current time (at the server side) to the user. The index page should have the message "The current time is: <time>". It should also have a button that says "Update". The user should be able to click the button to update the time. However, only the time portion should get updated - not the entire page.

Advanced Web Development - "Unit and Functional Testing Lab"

1. Clone the project from https://github.com/siddharthkaza/depot_p_for_lab.gitunder the lab and import into the IDE.

a. Run the application to make sure it's running in the browser.

Hint: It's always a good idea to run 'bundle update and then 'rake db:migrate' and 'rake db:seed' first - when using an application from another location. This updates any gems needed and brings the DB to its newest version.

1. Validations

Validations are methods that are placed in the model to validate data before records are entered in the database.

In the depot application, we will put in validations in the product model to prevent bad data from being entered in the database (for instance, 'a product should always have a title').

a. Run the depot application, enter a new product in the database (go to /products in the URL to get to the products listing).

b. What validations do you think the product model needs? List them here.

c. Enter the following statements in the product model (product.rb) one-by-one

validates :title, :description, :image_url, presence: true

validates :price, numericality: {greater_than_or_equal_to: 0.01}

validates :title, uniqueness: true

validates :image_url, allow_blank: true, format: {

with:    %r{\.(gif|jpg|png)\Z}i,

message: 'must be a URL for GIF, JPG or PNG image.'

}

validates :title, length: {minimum: 10}                                   

d. Create another product that fails the validations (for e.g., leave the title empty). You notice that errors show up at the top of the page after you have. How does that work? What data structures are being used in the view to show the errors?

e. Are there any more validations that you want see in the products model? Think about how you would add them. Bring them up when we discuss the lab in the class.

2. Testing

b. Study the model tests for the 'products' model in the application (they are located under the 'tests' folder). Run those model tests and see the results. The command to run all the model tests (also known as 'unit' tests) in your application is 'rake test:units'

Do you think the application needs more unit/model tests for products? Explain here.

c. Study the controller tests in the application. Run the functional tests (rake test:functionals) and see the results.

i. You will notice that some functional tests fail. Why do they fail? Study the assert_difference method for one of them. When one of the test fails you get a message:

Product.count didn't change by -1

<2> expected but was

<4>.

What do the numbers <2> and <4> mean?

ii. Fix the code so that all failing tests pass.

3. Download the address book application https://github.com/siddharthkaza/addressbook_rails42

Write two unit tests and two functional  tests for the application. See the examples in depot_p.  You might have to write the validations in the model to write unit tests.

4. How much time did you spend on this lab?

Attachment:- Assignment.rar

Reference no: EM131143706

Questions Cloud

Estimate how many miles this star travels in one year : It takes 3x107 years for a particular star to make one orbit around its galaxy. Assume that this star's orbit in its galaxy is circular with a diameter of 104 light years. A light year is the distance that light travels in one year. There are about 5..
Pay the mortgage off by repaying the outstanding balance : 4-21. When you purchased your house, you took out a 30-year annual-payment mortgage with an interest rate of 6% per year. The annual payment on the mortgage is $12,000. You have just made a payment and have now decided to pay the mortgage off by repa..
Evaluate the technology trends available to help : Your detailed promotional strategy to support theintroduction(Advertising, sales promotion, sales force, direct marketing, P/Retc) Include your promotional budget, Evaluate the technology trends available to help youmarket the product.
What is a reflective cross-site scripting attack : What is a reflective cross-site scripting attack? Which Web application attack is more likely to extract privacy data elements out of a database?
Develop a ror application that shows the current time : Develop a RoR application that shows the current time (at the server side) to the user. The index page should have the message "The current time is: ".
The following was published with the financial statements : Write a brief memo to your instructor discussing American Exploration Company's note regarding property, plant, and equipment. Your memo should address what is meant by the "successful efforts method" and "units-of-activity method."
Three largest consumer segments within particular market : After reading the chapters and lecture notes regarding marketing segmentation and target markets, select one of the following product categories (cars, trucks, SUV’s, shoe stores, men’s or women’s clothing stores, computers, beer, headphones, or fitn..
What is the main difference between a virus and a trojan : What is the main difference between a virus and a Trojan? A virus or malware can impact which of the three tenets of information systems security (confidentiality, integrity, or availability)? In what way?
Determine which proposal will be the final outcome : Finally, the last person has the right to pass it or reject it. If the last person's payoff is the smallest among the three, then the proposal will be rejected and no one will get anything. The decision making process can be done by only one time. Pl..

Reviews

Write a Review

Web Project Questions & Answers

  Which command makes bullets in making the site

Which command makes Bullets in making the site?a. OLb. ULc. BRd. HRe. All answers True

  Understand the concepts of web application development

Understand the concepts of web application development - Discuss various features and advantages of web application development and how they relate to the business model of your choice.

  Create a web page using color or an image as a background

Create a web page using color or an image as a background, add an image into the body of text, and then add colors that are compatible to the design. You should also include some "mock" text to your page to show position of text.

  Locate the web site for barrister winery

You must save the worksheet document again before you attempt to submit it via the Assignments tool.This assignment will be due February 21 and will be graded.

  Describing role of codes

My application is an IQ web app and has a mobile app with it. It functions well, and it's complete, I just need someone to document it and write a paper that shows how everything ties together by taking segments of each code and describing their r..

  Graph the demand data

Graph the demand information for YarDarts. Forecast the demand for YarDarts for the next five years using the graphical judgment approach.

  Create a one-page professional-looking personal website

Create a one-page professional-looking personal website using only HTML and CSS. You may build your site on any topic of your choosing.

  Create a prototype or mockup of homepage and secondary page

Based on your recommendations from attachments, create a prototype or mockup of the homepage and a secondary page of your choice for your assigned/chosen Virtual Organization.

  Develop complex web site or piece of multimedia from scratch

Develop a complex web site or piece of multimedia from scratch, using information gathering and design techniques. Expand their skills in design prototyping. Expand their skills in the use of multimedia and web authoring software.

  Describe techniques for optimizing web form usability

Imagine that a local college hired you to look at a lengthy form on the university's office of admissions Website. Prospective students have been calling the office to request information instead of utilizing the university's Website.

  Enter the correct command to display

Enter the correct command to display the look as shown below:"The key input type =" submit ": beauty

  What are the ways in which conversion can be increased

What are the ways in which conversion can be increased? Support your statements with appropriate examples and scholarly references

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd