Friday, December 7, 2012

[Rails] Re: Sorting an array of string-integer identifiers

Walter Davis wrote in post #1088232:
> On Dec 7, 2012, at 10:53 AM, Avantec Van wrote:

>
> The first question I would have is, how did you get this array in the
> first place? If it's the output from an ActiveRecord query, then you
> could most profitably sort there in the data-gathering stage. Otherwise,
> if you redefine your sort method (or use a custom sort method) then you
> should be able to sort by the value of index 0 of each sub-array, right?
>
> Walter

Hi Walter,
Thanks for your reply.
I'm getting this as params and I'm just making this into array.

my params is like this {"question_8_pdx_0"=>"", "question_7_sdx_8"=>"9",
"question_8_cpt_1"=>"", "course_id"=>"1", "answer_modifier_7_cpt_1"=>"",
"answer_quantity_8_cpt_0"=>"", "question_7_sdx_5"=>"6",
"question_7_cpt_2"=>"", "question_7_sdx_10"=>"11",
"question_8_icd9px_1"=>"", "question_7_adx_0"=>"298.9",
"answer_modifier_8_cpt_2"=>"", "question_8_sdx_2"=>"",
"question_7_icd9px_1"=>"", "question_7_sdx_2"=>"3",
"answer_quantity_8_cpt_2"=>"", "answer_quantity_7_cpt_1"=>"",
"question_7_sdx_7"=>"8", "user_id"=>"1", "question_8_cpt_0"=>"",
"context_type"=>"Course", "answer_modifier_7_cpt_0"=>"",
"question_7_sdx_4"=>"5", "question_7_cpt_1"=>"",
"question_8_icd9px_0"=>"", "question_8_sdx_1"=>"",
"question_7_icd9px_0"=>"", "question_7_sdx_1"=>"2",
"question_7_pdx_0"=>"2323", "question_7_sdx_9"=>"10",
"answer_quantity_7_cpt_0"=>"", "answer_modifier_7_cpt_2"=>"",
"question_7_sdx_6"=>"7", "context_id"=>"1", "question_7_sdx_11"=>"",
"question_8_icd9px_2"=>"", "question_7_icd9px_2"=>"",
"question_7_sdx_3"=>"4", "question_7_cpt_0"=>"",
"answer_modifier_8_cpt_0"=>"", "question_8_adx_0"=>"",
"question_8_sdx_0"=>"", "answer_quantity_7_cpt_2"=>"",
"question_7_sdx_0"=>"1"}

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate