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

  • Home
  • SEARCH
  • 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 8835693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:19:01+00:00 2026-06-14T09:19:01+00:00

I am really confused with how rendered paginated objects work. Take this for example:

  • 0

I am really confused with how rendered paginated objects work. Take this for example:

When I run

<%= render :partial => 'feeds/share_item', collection: @share_items %>
<%= will_paginate @share_items %>

I can go to _share_item.html.erb and inside of it I can do this…

<%= link_to "Delete", share_item, method: :delete, 
data: { confirm: "Are you sure you want to delete this?" }, 
class: "btn-link", title: share_item.content %>

…and it will have the Delete link and all goes well.

But, while still in _share_item.html.erb, if I replace that with…

<%= render :partial => 'shared/delete' %>

…I get this:

undefined local variable or method 'share_item' for #<#<Class:0xaf0b888>:0xb15cb3c>

Why?

I have been trying to resolve this issue for quite some time, because I have a lot of forms and links cluttered in my partial. I want to be able to render said forms and links via another partial.

Thanks for your 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-14T09:19:02+00:00Added an answer on June 14, 2026 at 9:19 am

    Right now, the variable share_item is empty, as it has not been supplied to the partial.
    You would need to do something like this:

    <% @share_items.each do |share_item| %>
      <%= render :partial => 'shared/delete', :locals => { :share_item => share_item } %>
    <% end %>
    

    Or, the slightly more terse

    <% @share_items.each do |share_item| %>
      <%= render 'shared/delete', share_item: share_item %>
    <% end %>
    

    Or, even better:

    <%= render 'shared/delete',  collection: @share_items %>
    

    You can find more info here.

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

Sidebar

Related Questions

I am really confused how to word this question. I need to take some
I'm really confused, I just wrote this x = 0 y = 42 #Can
I'm really confused. I'm using Django 1.4 and I've been searching for this the
I'm really confused at how to do this. I'm tired and frustrated as well,
I'm really confused right now. This is my piece of code: NSFileManager *manager =
I'm really confused and have been scratching my head over this for a few
I am really confused with this. Here I've got a div whose position should
I'm sorry for this question that seems really stupid but i'm really confused with
I`m really confused here about this weird behavior! The thing is, I have a
Got really confused on how JavaScript/BackboneJS works. Let's consider the following example: window.MyView =

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.