Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9200509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:47:04+00:00 2026-06-17T22:47:04+00:00

Im try pass a variable by the my rails partial but this error SyntaxError

  • 0

Im try pass a variable by the my rails partial but this error

SyntaxError in Posts#index

Showing /Users/overallduka/Blog1/app/views/posts/_posts_mason.html.erb where line #5 raised:
Extracted source (around line #5):

2:  
3:     <%= link_to "Add to Journal", add_post_journal_path(@post), :method => :put %>
4: 
5:     <h2><%= link_to @post.title,post_path(@post) %></h2>
6: <%= image_tag @post.image.url,:class => "thumb" %> <br>
7: 
8: <%= @post.content  %>

im try exibe this partial _posts_mason.html.erb

  <div id="post"  >

    <%= link_to "Add to Journal", add_post_journal_path(@post), :method => :put %>

    <h2><%= link_to @post.title,post_path(@post) %></h2>
<%= image_tag @post.image.url,:class => "thumb" %> <br>

<%= @post.content  %>

  <br>
  <p>Por <%= @post.user.email %> em <%= @post.created_at.strftime("%d %b. %Y") %> ás <%= @post.created_at.strftime("%H:%M") %></p>



  <div id="post_footer">


  <%= link_to_function "Comentar","
  $(this).fadeOut();
if($('#comment_form_#{@post.id}').css('display') == 'none')
{
$('#comment_form_#{@post.id}').slideDown();
}
else $('#comment_form_#{@post.id}').slideUp();
$('.comentar.#{@post.id}').hide();
",:class=>"comentar"

%>

<div id="comment_form_<%= @post.id %>" style="display: none;" >

  <%= form_for [@post,@post.comments.build], :remote => true do |com| %>
      <%= com.text_area :comment %>

      <%= com.submit 'Comentar' %>


  <%end %>
  </div>


      <div class="comment_list <%= @post.id %>">
  <% @post.comments.each do |comment|   %>

      <% if comment.comment %>
                <div id="comments">
      <%= comment.user && comment.user.email %>:
           <%= comment.comment %>
                </div>
          <%end%>



   <%end%>

      </div>

<br>



  </div><!--Fim div #post_footer-->


</div>

Im pass the variable of the loop each, this code:

<% @posts.each do |post| %>


<%= render :partial => "posts_mason",:locals => { post => @post } %>


<% end %>

what is wrong, before transform the content in partial are working perfect i dont know what is wrong please help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T22:47:05+00:00Added an answer on June 17, 2026 at 10:47 pm

    thanks for the help, i solve the problem but whit the :collection

    i change my partial name to _post.html.erb

    and change my variables @post by post in partial

    but a note, the partial variable passed by collection need be same name of the partial,

    by example if my partial calling _post_mason.html.erb, my variable in partial must be post_mason, i wait all understand me , this solve my problem, the variable passed by the :collection must be same name of partial.

    Thanks for the answers all help me, thanks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to pass variable from jquery to code c# but something is wrong.
I try to pass my variable to constraint in form validator, but can't. i'm
I want to pass more than one variable to other web pages. I try
When I try to pass variable with values like ?page=1 it redirected with http://wyciwyg://{number}
I try to pass a variable from onclick another function. The content is created
Whenever I try to pass a variable through url with the l() function like:
I try to pass Package variable to my UserControl: <uc:Template ID=Template runat=server Package=<%=TemplateParams.SimpleSearch %>
for some reason whenevever i try to pass 0 using a url parameter variable,
Hello I'm getting an error when i try to pass a char through to
I have to pass a variable through an animation sequence, but I'm having trouble

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.