# Issues with rails 1.2: passing an array using link\_to

**URL:** <https://www.ruby-forum.com/t/issues-with-rails-1-2-passing-an-array-using-link-to/83596>\
**Category:** Rails\
**Created:** [January 27, 2007, 11:33am UTC](https://www.ruby-forum.com/t/issues-with-rails-1-2-passing-an-array-using-link-to/83596 "2007-01-27T11:33:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![albert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/48db29/32.png) [@albert](https://www.ruby-forum.com/u/albert)\
**Post date:** [January 27, 2007, 11:33am UTC](https://www.ruby-forum.com/t/issues-with-rails-1-2-passing-an-array-using-link-to/83596/1 "2007-01-27T11:33:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![albert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/48db29/32.png) [@albert](https://www.ruby-forum.com/u/albert)\
**Post date:** [January 28, 2007, 5:23pm UTC](https://www.ruby-forum.com/t/issues-with-rails-1-2-passing-an-array-using-link-to/83596/2 "2007-01-28T17:23:00Z")

</div>

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](http://madhatted.com)

---

<div class="post-metadata">

**Author:** ![albert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/48db29/32.png) [@albert](https://www.ruby-forum.com/u/albert)\
**Post date:** [January 31, 2007, 7:24pm UTC](https://www.ruby-forum.com/t/issues-with-rails-1-2-passing-an-array-using-link-to/83596/3 "2007-01-31T19:24:07Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![albert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/48db29/32.png) [@albert](https://www.ruby-forum.com/u/albert)\
**Post date:** [January 31, 2007, 7:50pm UTC](https://www.ruby-forum.com/t/issues-with-rails-1-2-passing-an-array-using-link-to/83596/4 "2007-01-31T19:50:55Z")

</div>

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](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.[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
> ```
>   
> --~--~---------~--~----~------------~-------~--~----~  
> 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 removed\_email\_address@domain.invalid   
> To unsubscribe from this group, send email to removed\_email\_address@domain.invalid   
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en   
> -~----------~----~----~----~------~----~------~--~---

---

<div class="post-metadata">

**Author:** ![albert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/48db29/32.png) [@albert](https://www.ruby-forum.com/u/albert)\
**Post date:** [January 31, 2007, 8:40pm UTC](https://www.ruby-forum.com/t/issues-with-rails-1-2-passing-an-array-using-link-to/83596/5 "2007-01-31T20:40:19Z")

</div>

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

Many thanks, everything works fine now.
