Reputation: 299
Here I am getting values from my model and I am putting it as an instance variable in my controller:
@users = User.where(:approved => true, :enabled => true)
now I want @users
to behave as an array so that I can perform the following operation:
@users = @users | current_user
i.e an array union. any pointers ?
Upvotes: 0
Views: 505
Reputation: 299
this would initialize the @current_user
array:
@current_user = [current_user]
then I did
@users = @current_user | @users
and it worked!
Please suggest if you have a better solution.
Upvotes: 0