ruby - Rails - what's the correct path for inner controllers? -
i have setup in routes.rb:
resources :users resources :images resources :comments end end
when load show action imagescontroller, in template file:
... = render 'comments/form', :@comment => @image.comments.new ...
and in comments/form file following:
= form_for [@comment.commentable, @comment] |f| .field = f.text_field :body .actions = f.submit 'comment'
and show action:
def show @user = user.find(params[:user_id]) @image = @user.images.find(params[:id]) respond_to |format| format.html # show.html.erb format.json { render :json => @image } end end
but when load page in browser, error:
undefined method `image_comments_path' #<#<class:0x007feb48488128>:0x007feb48399668>
why rails returns error message?
open terminal , type rake routes
see right routes available in app
Comments
Post a Comment