In my ruby on rails application I have a show.html.erb page that displays the details of a film, what I want to do is display the dates that film is being shown. In the show.html.erb file I have done this so far:
<% @film.showings.each do |film| %>
<%= @film.showings.show_date %>
<% end %>
And in my models I have the associations:
film.rb:
class Film < ActiveRecord::Base
has_many :showings
validates :title, presence: true, length: { minimum: 3 }
end
showing.rb:
class Showing < ActiveRecord::Base
belongs_to :film
end
In my showings_controller.rb:
class ShowingsController < ApplicationController
def show
@showing = Showing.find(params[:id])
end
end
What am I doing wrong? At the minute I get the error:
NoMethodError in Films#show
undefined method show_date for #
What should I be doing?
show.html.erbbelong?