javascript - rails ajax to render form -


I have an "join" button on my page, when clicked, the user gets model In my join.js.erb file like a follow button, I am partially interpreting after joining the user, as if to show partially the same way with a Forms where they can now comment on the model. Here it is visible.

  * join.js.erb * $ ("# restaurant- & lt;% = @ restaurant.id%>"). Html ("& lt;% = escape_javascript render: partial = & gt; 'restaurant / joint_button' ,: local = & gt; {: restaurant = & gt; @restaurant}% & gt;"); $ ("# Restaurant comment form"). Html ("& lt;% = escape_javascript render: partial = & gt; restaurant / comments_form ',: local = & gt; {: restaurant = & gt; @restaurant}% & gt;");   

The comment here is partial

  & lt;% if current_user.voted_on? (Restaurant)% & gt; & Lt; div class = "section-cover section-cover-two" & gt; & Lt; h4 class = "text-muted text-center" style = "margin: 0 10px;" & Gt; Write a review & lt; / H4 & gt; & Lt;% = Render: Partial = & gt; "Comments / Forms" ,: Local = & gt; {: Comment = & gt; @ Comment}%> & Lt; / Div & gt; & Lt;% end% & gt;   

Hence the JS file is partially rendering, which is partially presenting with the local people.

Where the error I am getting is

The first argument in the form can not be included in the vacuum or can be empty
  ActionView :: Template :: Error form first argument can not be zero or empty): 1: & lt;% = form_for ([commentable, @comment]) | F | & Gt%;   

I think this comment is an issue with the local people in the party. Does anyone know a proper solution for this ?? Thank you

I have already tried it comments_form partial

  <% = render: partial = & gt; "Comments / Forms" ,: Local = & gt; {: Restaurant = & gt; @commentable ,: Comment = & gt; @ Comment}%>    

According to the chat session, @comment and @commentable Examples were not set to join in action. Therefore, the first argument in the form of error form can not be zero or empty

  start join the def @vote = current_user.vote_for (@restaurant = restaurant.friendly.find params [: Id])) @commentable = @restaurant ## Set price @ Comment = Comment. New ## Set with response_with @restaurant ,: location = & gt; restaurant_path (@restaurant) ActiveRecord Rescue: Record invalid redirect-to-restaurant_path (@storeature) end and    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -