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 Importer | |
def self.get_film_links | |
doc = Nokogiri::XML(open('http://jagmit.co.uk/ruby/all-performances.xml')) | |
doc.xpath('//cinema').each do |cinema_data| | |
import_cinema(cinema_data) | |
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
def self.import_location(cinema_data) | |
location = Location.find_or_create_by_title(cinema_data[:name]) | |
cinema_url = cinema_data[:url] + cinema_data[:postcode] | |
location.update_attributes(:adressing => cinema_url) | |
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
$(document).ready(function(){ | |
$.jsonp({ | |
url: 'http://twitter.com/status/user_timeline/samcroft.json?count=20', | |
callbackParameter: 'callback', | |
success: function(data, status) { | |
//$('#your-tweets').append('<li>The feed loads fine'); | |
$.each(data, function(i,item){ | |
var tweet = item.text; | |
$('#your-tweets').append('<li>'+tweet); | |
}); |
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
NoMethodError in CinemasController#index | |
undefined method `macro' for nil:NilClass | |
Rails.root: /Users/staceyrhodes/Documents/Whatever/morevue | |
Application Trace | Framework Trace | Full Trace | |
app/controllers/cinemas_controller.rb:9:in `block (2 levels) in index' | |
app/controllers/cinemas_controller.rb:7: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
class Moreeven < ActiveRecord::Migration | |
def up | |
drop_table :screening | |
create_table :screenings do |t| | |
t.integer :cinema_id | |
t.integer :film_id | |
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
source 'http://rubygems.org' | |
gem 'rails', '3.1.1' | |
gem 'therubyracer' | |
# Bundle edge Rails instead: | |
# gem 'rails', :git => 'git://github.com/rails/rails.git' | |
gemfile, gem 'pg', :group => :production |
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
<p id="notice"><%= notice %></p> | |
<h1><%= "Screening: \"#{@screening.film.title}\" at #{@screening.cinema.name}, #{@screening.cinema.url}" %></h1> | |
<p> | |
<b>Show Times:</b> | |
<ol> | |
<% @screening.shows.each do |show| %> | |
<li><%= show.showed_at %></li> | |
<% 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 Cinema < ActiveRecord::Base | |
has_many :screenings | |
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
require 'nokogiri' | |
require 'open-uri' | |
class Importer | |
def self.get_film_links | |
doc = Nokogiri::XML(open('http://jagmit.co.uk/ruby/all-performances.xml')) | |
doc.xpath('//cinema').each do |cinema_data| |
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 Importer | |
def self.get_film_links | |
doc = Nokogiri::XML(open('http://jagmit.co.uk/ruby/all-performances.xml')) | |
doc.xpath('//cinema').each do |cinema_data| |