ryanb082
9/11/2015 - 12:14 AM

Fixing ID error categories

Fixing ID error categories

%section.genre
 %header.clearfix
  %h1=@category.name
  .genre_sorting
  Sort by:
  %select(name="")
    %option(value="a-z") Title: A - Z
    %option(value="z-a") Title: Z - A
    %option(value="rating") Rating
  %article.row
    - @category.videos.each do |video|
      .video.col-md-2
        = link_to video, nil do
          = image_tag video.small_cover_url
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
#   cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
#   Mayor.create(name: 'Emanuel', city: cities.first)




Video.create(title: 'Family Guy', 
  description: 'Seth McFarlene animation show about Peter Griffin.',
  small_cover_url: '/tmp/family_guy.jpg', 
  large_cover_url: '/tmp/monk_large.jpg',
  category_id: 1)

Video.create(title: 'Family Guy',
  description: 'Seth McFarlene animation show about Peter Griffin.',
  small_cover_url: '/tmp/family_guy.jpg', 
  large_cover_url: '/tmp/monk_large.jpg',
  category_id: 2)

Video.create(title: 'South Park',
  description: 'South Park based on a cartoon in Dever',
  small_cover_url: '/tmp/south_park.jpg', 
  large_cover_url: '/tmp/monk_large.jpg',
  category_id: 1)

Video.create(title: 'South Park', 
  description: 'South Park based on a cartoon in Dever',
  small_cover_url: '/tmp/south_park.jpg', 
  large_cover_url: '/tmp/monk_large.jpg', 
  category_id: 2)

Video.create(title: 'South Park', 
  description: 'South Park based on a cartoon in Dever',
  small_cover_url: '/tmp/south_park.jpg', 
  large_cover_url: '/tmp/monk_large.jpg',
  category_id: 1)
class Category < ActiveRecord::Base
  has_many :videos

end
class CategoriesController < ApplicationController

  def show
    @category = Category.find(params[:id])
  end

end