Hello ,
I have a home work shown below i did most of the things , i wrote rthml and database in netbeans but i cant run
Homework and code i wrote are below what is missing here i dont know please help . I cant run it
Implement a WEB application using the RAILS framework for maintaining an online directory on hotels. Each entry in the directory will have the following fields:
hotel name city year built "star" classification (how many stars, integer) home many rooms pool (yes/no) You will need to create a database using the meta-data given above in either MYSQL, POSTRESQL or some other database system that is familiar to you. The table can be created either using SQL and the interface of your database system, or from within RoR, using migrations.
The operations that should be implemented are:
Create a new hotel Delete a hotel Show all hotels Find an entry by hotel name and display it Find and display hotels which have pools
Include pictures of hotels in the database and show them also.
RB FILE
class Assignment < ActiveRecord::Migration def self.up create_table : Hotels do |t| t.coloumn : hotel_name, :string t.coloumn : city, :string t.coloumn : yearbuilt, :int t.coloumn : star, :int t.coloumn : numofrooms, :int t.coloumn : pool, :string end
Hotel.create : hotel_name => "Anatolia Beach Hotel" , city =>"Kemer", yearbuilt =>"2004",star=>"5",numofrooms=>"1200",pool=>"yes"
Hotel.create : hotel_name => "Catamaran Resort" , city =>"Fethiye", yearbuilt =>"2006",star=>"5",numofrooms=>"860",pool=>"yes"
Hotel.create : hotel_name => "Oasis Beach Club" , city =>"Kas", yearbuilt =>"2001",star=>"7",numofrooms=>"3600",pool=>"yes"
Hotel.create : hotel_name => "Dedeman" , city =>"Cesme", yearbuilt =>"2003",star=>"5",numofrooms=>"450",pool=>"yes"
end
def self.down drop_table : hotels end end
class Assignment < ApplicationController def alllist @hotels = Hotel.find(:all) end end
RHTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>List of Hotels</title> </head>
<body> <%for Hotel in @Hotels %> <li><%=Hotel.hotel_name %> </li> <%end%> </body> </html>