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
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Matthew Beale
2007-Jan-28 16:21 UTC
Re: issues with rails 1.2: passing an array using link_to
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 Beale :: 607 227 0871 Resume & Portfolio @ http://madhatted.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Matthew Beale 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 Beale :: 607 227 0871 > Resume & Portfolio @ http://madhatted.comhi, 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 -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jack Christensen
2007-Jan-31 18:50 UTC
Re: issues with rails 1.2: passing an array using link_to
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
albert wrote:
<blockquote
cite="mid6553b72fcfeea2a55f0cb5ebdea8f07a-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org"
type="cite">
<pre wrap="">Matthew Beale wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On Sat, 2007-01-27 at 11:33 +0100, albert
wrote:
</pre>
<blockquote type="cite">
<pre wrap="">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 Beale :: 607 227 0871
Resume & Portfolio @ <a class="moz-txt-link-freetext"
href="http://madhatted.com">http://madhatted.com</a>
</pre>
</blockquote>
<pre wrap=""><!---->
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
</pre>
</blockquote>
Check out Rails Ticket #7047. It sounds like your problem.<br>
<br>
<pre class="moz-signature" cols="72">--
Jack Christensen
<a class="moz-txt-link-abbreviated"
href="mailto:jackc-/SOt/BrQZzMOf2zXYvRtkodd74u8MsAO@public.gmane.org">jackc-/SOt/BrQZzMOf2zXYvRtkodd74u8MsAO@public.gmane.org</a></pre>
<br>
--~--~---------~--~----~------------~-------~--~----~<br>
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group. <br> To post to this group,
send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
<br> To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <br>
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en <br>
-~----------~----~----~----~------~----~------~--~---<br>
</body>
</html>
<br>
> Check out Rails Ticket #7047. It sounds like your problem.<br>Many thanks, everything works fine now. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---