Issues with rails 1.2: passing an array using link_to

Hi,

I have just updated to rails 1.2.
before this I could have pass an array of object through link_to however
now this is not working anymore. Any help is very appreciated.
Here is my code:

@all_member_studies = @member.member_studies

View:
<%= link_to (“test”
{:controller => ‘member’,
:action => ‘show_matrix’ ,
:member_studies => @all_member_studies %>

Controller:
def show_matrix
@member_studies = []
unless params[:member_studies].nil?
params[:member_studies].each do |ms|
@member_study = MemberStudy.find_by_id(ms)
@member_studies << @member_study
end
end
end

My @member_studies is returning NULL even though there are two records
in my database.

Many thanks

On Sat, 2007-01-27 at 11:33 +0100, albert wrote:

Hi,

I have just updated to rails 1.2.
before this I could have pass an array of object through link_to however
now this is not working anymore. Any help is very appreciated.
Here is my code:

development.log should show the contents of params[], are they showing
up there?


Matthew B. :: 607 227 0871
Resume & Portfolio @ http://madhatted.com

Matthew B. wrote:

On Sat, 2007-01-27 at 11:33 +0100, albert wrote:

Hi,

I have just updated to rails 1.2.
before this I could have pass an array of object through link_to however
now this is not working anymore. Any help is very appreciated.
Here is my code:

development.log should show the contents of params[], are they showing
up there?


Matthew B. :: 607 227 0871
Resume & Portfolio @ http://madhatted.com

hi,

Thanks for your reply.
the value that is passed to my controller (show_matrix) is:
Parameters:
{“member_studies”=>"#MemberStudy:0x496d5f8/#MemberStudy:0x496c590"}

However before I would have had this one:
{member_studies[]=5&member_studies[]=12}

I wonder I can change the code to get an array again.
Any help is greately appreciated

albert wrote:
Matthew B. wrote:
  
On Sat, 2007-01-27 at 11:33 +0100, albert wrote:
    
Hi,

I have just updated to rails 1.2.
before this I could have pass an array of object through link_to however
now this is not working anymore. Any help is very appreciated.
Here is my code:

  </pre>
</blockquote>
<pre wrap="">development.log should show the contents of params[], 

are they showing
up there?


Matthew B. :: 607 227 0871
Resume & Portfolio @ http://madhatted.com

hi,

Thanks for your reply.
the value that is passed to my controller (show_matrix) is:
Parameters:
{“member_studies”=>"#<MemberStudy:0x496d5f8>/#<MemberStudy:0x496c590>"}

However before I would have had this one:
{member_studies[]=5&member_studies[]=12}

I wonder I can change the code to get an array again.
Any help is greately appreciated

Check out Rails Ticket #7047. It sounds like your problem.

--
Jack C.
[email protected]

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Check out Rails Ticket #7047. It sounds like your problem.

Many thanks, everything works fine now.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs