I have a model (OrderFilter) not tied to a database table which I use to pass filter parameters to the view. The model and view are considerably more complicated than below but I've stripped it down to the bare essentials.
class OrderFilter
attr_accessor :role, :draft, :submitted, :approved, :processed, :errors
def initialize(user_id)
# @errors = []
end
end
# Controller
def index
@order_filter = OrderFilter.new(session[:user_id])
respond_to do |format|
format.html
end
end
# View:
<%= select(:order_filter, :role, ['a','b','c'] )%>
All worked as expected until I added an array to pass errors to the view (@errors). Initialising the array in the constructor (ie. uncomment # @errors = []) produces ActionView::Template::Error (no implicit conversion of String into Integer) on the select tag line.
Any help would be appreciated - I've searched high and low and can't find anything similar!