This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
require 'open-uri' | |
class CinemaSite | |
def self.get_cinema_links | |
doc = Nokogiri::XML(open('http://jagmit.co.uk/ruby/cinemas.xml')) | |
doc.xpath('//cinema[@name]').map do |i| | |
{name: i[:name], url: i[:url]} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
require 'open-uri' | |
class CinemaSite | |
def self.get_cinema_links | |
doc = Nokogiri::XML(open('http://jagmit.co.uk/ruby/cinemas.xml')) | |
doc.xpath('//cinema[@name]').map do |i| | |
{name: i[:name], url: i[:url]} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Cinemas < ActiveRecord::Migration | |
def up | |
add_column :postcode, :string, :telephone, :integer | |
def down | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Cinemas < ActiveRecord::Migration | |
def up | |
add_column :cinemas, :postcode, :string | |
add_column :cinemas, :telephone, :integer | |
def down | |
remove_column :cinemas, :telephone | |
remove_column :cinemas, :postcode | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cinemas> | |
<cinema name=" " phone=" " address=" " postcode=" " root=" " url="/cinemas/1" id="1"> | |
<films> | |
<film title="" rating="PG" release="24/10/2011"> | |
<shows> | |
<show date="Sun 30 Oct" time="10:40" videoType="digital"/><show date="Sun 30 Oct" time="13:10" videoType="digital"/> | |
</shows> | |
</film> | |
</films> | |
</cinema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
require 'open-uri' | |
class CinemaFilms | |
def self.get_film_links | |
doc = Nokogiri::XML(open('http://Whatever.com/ruby/all-performances.xml')) | |
doc.xpath('//film[@title]').map do |i| | |
{title: i[:title], rating: i[:rating], release: i[:release], length: i[:length], poster: i[:poster], director: i[:director], synopsis: i[:synopsis], cast: i[:cast] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Morevue::Application.routes.draw do | |
# The priority is based upon order of creation: | |
# first created -> highest priority. | |
# Sample of regular route: | |
# match 'products/:id' => 'catalog#view' | |
# Keep in mind you can assign values other than :controller and :action |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveRecord::RecordNotFound in FilmsController#index | |
Couldn't find Cinema without an ID | |
Rails.root: /Users/staceyrhodes/Documents/Whatever/morevue | |
Application Trace | Framework Trace | Full Trace | |
app/controllers/films_controller.rb:5:in `index' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
require 'open-uri' | |
class CinemaFilms | |
belongs_to :cinemas | |
def self.get_film_links | |
doc = Nokogiri::XML(open('http://jagmit.co.uk/ruby/all-performances.xml')) | |
doc.xpath('//film[@title]').map do |i| | |
{title: i[:title], rating: i[:rating], release: i[:release], length: i[:length], poster: i[:poster], director: i[:director], synopsis: i[:synopsis], cast: i[:cast] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1 style="text-transform:uppercase;text-align:center;border-bottom:2px solid black;padding-bottom:10px;">Cinema listings for Cineworld</h1> | |
<table> | |
<tr> | |
<th style="text-decoration:underline;">ID</th> | |
<th style="padding-right:50px;"></th> | |
<th style="text-decoration:underline;">Name</th> | |
<th style="padding-right:50px;"></th> | |
<th style="text-decoration:underline;">Address</th> | |
<th style="padding-right:50px;"></th> |