PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, May 18, 2022

[FIXED] How do I get this variable to be defined?

 May 18, 2022     partial, ruby, ruby-on-rails, ruby-on-rails-3, variables     No comments   

Issue

I have this code:

  <% @registered_friends.each do |friend| %>    
      <li><%= render 'profiles/fb_follow_form' %></li>
  <% end %>

It renders a partial in a different directory with this line:

<% if current_user != nil && current_user.following?(friend) %>

However my app is telling me that friend is undefined? How do I give myself access to the variable?


Solution

Changing <li><%= render 'profiles/fb_follow_form' %></li>

to <li><%= render 'profiles/fb_follow_form', :friend => friend %></li>

should do it



Answered By - AaronThomson
Answer Checked By - Cary Denson (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing