Transcribed TextTranscribed Text

Advanced Web Development – Rails Intro This programming exercise is aimed at giving you your first experience is developing a small Rails application. You will also get used to the environment. You might need to look at your book (Chapter 1,2,3,4) and the example code under Lecture 2 on the blackboard to complete this. Submission method: 1. If appropriate, submit a small description of your solution (the steps you followed to get to the solution – mention the files you edited). 2. If you are being asked to write code, submit relevant code snippets (paste here the parts you edited/added in an application provided to you) and screen shots. Submit a soft copy of the document using the assignment link on the blackboard. Do not upload separate files for the code and screenshots on blackboard – just one word/PDF document. Please use the class VM to complete this. These instructions are for Rubymine. If you are using another editor then you should be able to replicate them. 1. Clone the demo (course listing) completed in class during lecture from git. Git is a version control system (more on that later). ‘Cloning’ a project replicates the project on your machine. (10 points) a. Close all projects in Rubymine. If you do, it opens a ‘Welcome to Rubymine’ dialog. b. Select “Check out from version control”, select “git” c. Put the repository URL as . Hit clone. Follow steps to get the project open in your project window. This is the same project we did in class with some changes. d. Run the project and make sure it is working. It is always a good idea to issue the “bundle install” command every time you get a project on a new machine. e. All computer programmers agree that there needs to be a ‘help’ page in every application we write. Please put in some text in the help page. Paste a screen shot here. f. Show the current system time to the user using a new view. This view should be accessible from a URL http://localhost:3000/main/time . You will need to add both a view and a route (in routes.rb) to make time accessible. I have started the work for you by defining a method (called ‘actions’ in rails) in the main controller. Paste a screenshot here. g. Explain what routes.rb is doing. Can you allow a ‘POST’ method to the time action? 2. Design and implement a small Contact Book web application using RoR. Completely new application, start from scratch. (10 points) a. The main page will show a listing of all your contacts (name, phone, email, address) as an ordered list. You should define a Contact model for this. Please see example code under Lecture 2 for help. b. The main page will also have a link called “Logout” that will link to a page which shows the message “Good Bye”. This page also provides a link for going back to the main page. c. Show screenshots of the pages in your browser. 3. Read chapter 5 in book. Complete all code in Chapter 6. Include a screenshot that shows that you have completed the last iteration in the chapter. (10 points) 4. Answer the following questions very briefly (you may have to research on the web): (5 points) a. What does the Gemfile in the root directory of your application do? Why is it important? b. How do you replace the first page from the default “Welcome Aboard” page to your applications main page when you start the server.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

1. Task 1
a. Navigate to project folder “” , enter this command : bundle install
b. Open help.html.erb at /home/csuser/newwork/Lec2DemoRails42/app/views/main
c. Add this piece of code to it
    This is help page
d. Add thislines to routes.rb
get 'main/time'
e. Create time.html.erb at /home/csuser/newwork/Lec2DemoRails42/app/views/main
f. Add these lines to it
<h1>Time </h1>
It is now <%= @time %>
2. Task 2
a. Navigate to a suitable folder
b. Run those command lines
rails new ContactBook
cd ContactBook/
rails generate controller main goodbye index
rails server
c. Open main_controller.rb at /home/csuser/newwork/ContactBook/app/controllers to add these lines
def index
    contact1 ="John Smith","1565498948","", "New York")
    contact2 ="Bill Gates","4689684989","", "Florida")
    contact3 ="Steve Job","989898484","", "Ohio")
    @contacts = [contact1,contact2, contact3]
def goodbye

By purchasing this solution you'll be able to access the following files:

50% discount

$68.00 $34.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Web Development (HTML, XML, PHP, JavaScript, Adobe, Flash, etc.) Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats