Hello everyone,
New to programming and hoping someone can help with this.  I'm trying to
format a hash in a model so I can access the individual values in a view
as follows. (I pulled most of the code out but this is the basic
idea)...


 def set_format_for_presentation  # This method is in the model.
     answer_list = [
       [self.incorrect_ans_1, self.incorrect_anno_1,
self.incorrect_ans_pict_1],
       [self.incorrect_ans_2, self.incorrect_anno_2,
self.incorrect_ans_pict_2]
       .shuffle

       #  Create hash of virtual attributes.
       formatted = {
                     :anno_1 => answer_list[0][1],
                     :anno_2 => answer_list[1][1],
                     :anno_pict_1 => answer_list[0][2],
                     :anno_pict_2 => answer_list[1][2]}

   end


So how do I pass the hash "formatted" to either a controller or access
the values (:anno_1 ect...) in the view?

Any help pointing me in the right direction would be greatly
appreciated.  Thanks.
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to