M
Mark Mr
Hi, I have a hash and i need to pass it to a function in another
controller. Here's what I have to do that
<%= link_to 'View', :controller => :attempts, :action => :show_cbam, :id
=> a.code, ercentiles =>@percentile_hash%>
where @percentile_hash is the hash I have. Then I call it in the other
controller like this
def show_cbam
@percentiles = params[ercentiles]
This seems to work ok, i can see the hash in my view but it doesnt work
properly.
Here's an example of my hash
@percentiles = {1=>[88,99,100]}
When i call @percentiles it outputs 18899100 so it seems fine but when i
call @percentiles[1] it returns 54. I have no idea why, it should return
the array [88,99,100]. Furthermore, for values like @percentiles[2]
it'll return like 55 even though there is no value associated with 2.
does anyone understand why this is happening? thank you
controller. Here's what I have to do that
<%= link_to 'View', :controller => :attempts, :action => :show_cbam, :id
=> a.code, ercentiles =>@percentile_hash%>
where @percentile_hash is the hash I have. Then I call it in the other
controller like this
def show_cbam
@percentiles = params[ercentiles]
This seems to work ok, i can see the hash in my view but it doesnt work
properly.
Here's an example of my hash
@percentiles = {1=>[88,99,100]}
When i call @percentiles it outputs 18899100 so it seems fine but when i
call @percentiles[1] it returns 54. I have no idea why, it should return
the array [88,99,100]. Furthermore, for values like @percentiles[2]
it'll return like 55 even though there is no value associated with 2.
does anyone understand why this is happening? thank you