views:

147

answers:

0

Im using Ruby on Rails and im adding an array of users into a session object. The problem is when I add it to the session I get the following error

Status: 500 Internal Server Error singleton can't be dumped

The problem is my user class called Expert is not a singleton class. The following is a snippet of my controller code.

if @experts.empty?
  @experts = expert_word_search(@search_params)
  @page_results = paginate_array(@experts.uniq)
end
session[:search_results] = @page_results
session[:complete_search_results] = @experts

I realize that storing the page_results in session is a bad design choice but my question is why does it throw a "singleton can't be dumped error". Since my expert class is not a singleton class and the method expert_word_search belongs to a module which handles the search logic.

Could somebody please explain this to me.