Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Partial counter with :as option

#1790

When rendering a partial with :as option for redefine the object name, the partial counter name isn't redefined

Example: in views/users/index.html.erb:

render :partial => 'users/smart_user', :collection => @users, :as => :user

in views/users/_smart_user.html.erb

# user_counter does NOT exist and you need to use smart_user_counter instead # but this is not optimal right?

Reported by Thibaud Guillaume-Gentil · January 23rd, 2009 @ 09:48 AM

State: stale
Milestone: 3.x
Assigned to: Pratik Pratik
Importance: none

Activity

  1. Pratik
    Pratik
    • Assigned user set to Pratik

    Yup. Looks like a bug to me. Do you wanna take a stab at writing a patch/test ? http://guides.rails.info/contrib... might be useful. Let me know if you need any help!

    March 23rd, 2009 @ 11:17 AM

  2. Thibaud Guillaume-Gentil
    Thibaud Guillaume-Gentil

    Ok, I'll try to write a patch/test this week.

    March 23rd, 2009 @ 07:28 PM

  3. Thibaud Guillaume-Gentil
    Thibaud Guillaume-Gentil

    Ok, it was an easy patch :-), here the diff file with the related test.

    I'm not sure if the 'if as' is useful in partials.rb, maybe it slow down the function but it's more secure no?, what do you think?

    March 23rd, 2009 @ 08:04 PM

  4. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.x to 3.x

    May 4th, 2010 @ 06:48 PM

  5. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to open
    • Importance changed from to

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

    February 2nd, 2011 @ 04:42 PM

  6. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 2nd, 2011 @ 04:42 PM