I have a simple_form_for new_comment that results in a undefined method
comments_path'` error in the browser, when I simply try to view the form (not submit)
_form.html.slim
= simple_form_for new_comment, :remote => true do |f|
This is in a partial, so the local variable passed is from the show page of hacks scaffold
show.html.slim - hacks
= render partial: "comments/form", locals: { new_comment: @new_comment } if user_signed_in?
I define @new_comment in the hacks controller
hacks_controller.rb
def show
@hack = Hack.find(params[:id])
@comments = @hack.comment_threads.order('created_at DESC')
@new_comment = Comment.build_from(@hack, current_user.id, "") if user_signed_in?
#build_from is a method provided by the acts_as_commentable_with_threading gem
end
Why would new_comment want to route to comments_path? I'm not even submitting the form.
routes.rb
root 'hacks#index'
concern :commentable do
resources :comments, only: [:create, :update, :destroy]
end
resources :hacks, concerns: [:commentable]
resources :users
devise_for :users, :skip => [:sessions, :registration]
devise_for :user, :path => '', :path_names => { :sign_in => "login",
:sign_out => "logout",
:sign_up => "register",
:account_update => "account-settings" }