Q: Iterate over a singleton or multiple of a returned DataMapper class I have the following code
if admin_authorized?
  @allschools = School.all
elsif faculty_authorized?
  @allschools = School.get(Faculty.get(session[:faculty_id]))
end

I am getting this error 
undefined method `each' for #<School:0x007f88a1360318>

@allschools will either be an array of schools or a singleton school.  I need to iterate over this list in the view, like so:
<% @allschools.each do |s| %>
  <%= f_optionselected(s.id.to_s, params[:school], s.name) %>
<% end %>

I've tried to do if statements with @allschools.count, @allschools.typeof(Array), ....
Should I use two different variables and a PHP type isset() statment to determine which block to display?  Or is there a way to iterate over the statement in some Ruby way?  

A: School.all returns an ActiveRecord::Relation and you can iterate through it, as you do with each. I think School.get returns a single School instance, right? Try to wrap it into an Array:
@allschools = [School.get(Faculty.get(session[:faculty_id]))]

