You seem to have defined @customer twice, once in the setup_friends method which is run first as a before_filter hook, and then again in the index method. the one in the index method returns an array, since you asked for @customer.all
On Aug 16, 2012, at 11:53 AM, Jean-Sébastien D. wrote: > Jason Fb wrote in post #1072568: >>> undefined method `friends' for #<Array:0xb6144040> >> >> >> You didn't show us the controller code that defines @customer but I'll >> bet you used something returned an array when you wanted a single >> object. > > Interesting about the Arel thing but here the controller > > class FriendsController < ApplicationController > > before_filter :setup_friends > > def index > @customer = Customer.all > end > > #Send a friend request > def create > Friends.request(@customer, @friend) > end > > private > def setup_friends > @customer = current_customer > @friend = Customer.find_by_id(params[:id]) > end > end > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

