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

  Evaluate potential expense increases for a budget worksheet

create scenarios to evaluate potential expense increases for a budget worksheet. Finally, you will use Solver to determine how many credits you can afford for a semester of graduate school.

  What value does this web site provide to the firm

Visit the Web site of your choice and explore it thoroughly. Prepare a report analyzing the various functions provided by the Web site and its information requirements. What value does this Web site provide to the firm

  Define the grid layout

In the production for layout_type that define the grid layout, the first two numbers represent the number of rows and columns, and the optional next two the horizontal and vertical gaps.

  Create and test an html documents that displays as a table

Create and test an HTML documents that displays as a table of football score from a collegiate football conference in which the team names have one of the primary colors of their respective schools.

  Create three wireframes for web site design

Create three Wireframes [storyboards] for your web site design Home Page and two others. These are rough designs to show placement of navigation, text and other elements on each of the pages.

  Identify the technology and the web page you found

Identify the technology and the Web page you found. Briefly summarize the article and then analyze two challenges of the chosen technology

  Explain how changes are documented and submitted

Explain how changes are documented and submitted in the change control management plan keeping in mind the factors such as roles and responsibilities related to the project

  Mlb project plan

Cover Page with project title, team names course number and name, professor's name, date.

  Create an html5 application

In the right hand div, create three questions about the table within an HTML5 form for the user to answer. Give more than 2-possible answers for the user to choose from for each question.

  Fnished developing the documentation for a system

1) Ray and Jason have just finished developing the documentation for a system your team recently completed. Ray insists that the documentation should be printed in booklet format and included with the system. Jason insists that paper manuals are outd..

  Describe how csss are used in developing websites.

How do you secure a domain name and find a host for a website. Describe how CSSs are used in developing websites

  What are the steps you have taken to maintain site

What are the steps you have taken to maintain and redesign your site over the past several weeks. How is the process that you followed similar to or different from how sites are maintained and redesigned in the professional environment

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