-1

I do have a Model called Community
I do have a attribute called author in communities table.

I do have models/community.rb

However this won't work. Why?

@communities = Community.find_by_author(params[:author])
Sergio Tulentsev
  • 226,338
  • 43
  • 373
  • 367
MKK
  • 2,713
  • 5
  • 31
  • 51

1 Answers1

1

find_by will give only first matching record. So use where to get all matching records.

 Community.where(:author => params[:author])
Rahul Tapali
  • 9,887
  • 7
  • 31
  • 44