Dear friends,
What is different between these two array method.
First Array Method
arr = ps_array["1"]
arr += ps_array["2"]
arr += ps_array["3"]
Second Array Method
arr = [ps_array["1"],ps_array["2"],ps_array["3"]]
yours,
phoesan
Dear friends,
What is different between these two array method.
First Array Method
arr = ps_array["1"]
arr += ps_array["2"]
arr += ps_array["3"]
Second Array Method
arr = [ps_array["1"],ps_array["2"],ps_array["3"]]
yours,
phoesan
On 2 July 2012 09:59, phoe san [email protected] wrote:
Dear friends,
What is different between these two array method.
First Array Method
arr = ps_array["1"]
What is the type of ps_array[“1”]
Colin
<%= collection_select(:sport_name,count,Sport.find( :all, :order => ‘id’
),
:id, :sport_name, {:selected =>@sport_id})%>
Collection_select Value.
We take data from collection_select by params[:sport_name]
In Controller, we use this
ps_array = params[:sport_name]
we get the data
First array method , It doesn’t work.
Second Method , It Work.
Regards,
phoesan
Hi,
Second scenario of your case works fine.
Thanks,
senthil
On 2 July 2012 10:26, phoe san [email protected] wrote:
First array method , It doesn’t work.
Second Method , It Work.
Please remember to quote the previous message, remember this is a
mailing list not a forum (though you may be accessing it via a forum
interface). Now we will have to look back at the previous message to
see your methods.
When you say
arr = ps_array[“1”]
arr is probably a string not an array, so then when you use
arr += ps_array[“2”]
it will concatenate the second string onto the first.
Have a look at the Rails Guide on debugging for ideas on how to debug
your code so that you can work out what is going on when you have this
sort of problem.
Colin
Hi Sentil and Colin,
ႊThank for your reply message and solution!
phoesan
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs