[Rails] Re: Friendship System Rails 3.0
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home