Skip to content

Instantly share code, notes, and snippets.

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
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
$(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);
});
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'
class Moreeven < ActiveRecord::Migration
def up
drop_table :screening
create_table :screenings do |t|
t.integer :cinema_id
t.integer :film_id
end
end
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
<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 %>
class Cinema < ActiveRecord::Base
has_many :screenings
end
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|
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|