I have created a tutorials section and categories section. now i want to create association between these two sections.i have added has_many in my tutorials model. this is my tutorial models definition:
class Tutorial < ActiveRecord::Base
has_many :tutorialcategories
I got an error "undefined method tutorial category" in show method.
this is my tutorialcategories controller's definition
class TutorialcategoriesController < ApplicationController
respond_to :json
def show
@tutorials=Tutorial.order("id ASC").all
@category = Tutorialcategory.find(params[:id])
Aucun commentaire:
Enregistrer un commentaire