<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>Recent Posts in 'how to assignee each value to correspoding key in a generic way' | Pragmatic Forums</title>
    <link>https://forums.pragprog.com/forums/22/topics/361</link>
    <language>en-us</language>
    <ttl>60</ttl>
    <description></description>
    <item>
      <title>how to assignee each value to correspoding key in a generic way posted by Sam Ruby @ Wed, 23 Apr 2008 19:56:30 -0000</title>
      <description>&lt;p&gt;Try &lt;code&gt;@test_runs.instance_variable_set("@#{key_name}", value)&lt;/code&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 23 Apr 2008 19:56:30 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:22:361:2622</guid>
      <author>Sam Ruby</author>
      <link>https://forums.pragprog.com/forums/22/topics/361</link>
    </item>
    <item>
      <title>how to assignee each value to correspoding key in a generic way posted by Bishnu Prasadit pradipta Narayan Das @ Fri, 11 Apr 2008 04:53:24 -0000</title>
      <description>&lt;p&gt;Hi all&lt;/p&gt;
	&lt;pre&gt;&lt;code&gt;**--my problem is that i get key and value .but i have to save in the data base 
in a generic ways.My code is like this:-&lt;/code&gt;&lt;/pre&gt;


	&lt;pre&gt;&lt;code&gt;local_keys = @params.keys
 first_addition = true
 param_value =0
 sql=String.new
  sql_value=String.new
 for key in 0...local_keys.length
 list=key.methods
       key_name = local_keys[key]
       value =  @params[key_name]
        puts "key "&lt;ins&gt;key_name.to_s&lt;/ins&gt; " value "+value.to_s 
         if key_name!="action" &amp;#38;&amp;#38; key_name!="controller" 
         @test_runs = TestRuns.new
            @test_run.ks=value(it is successful)(here ks is my column name)
but i want to save in a generic ways.
like  
         @test_runs.key_name= value.(it is not working )&lt;/code&gt;&lt;/pre&gt;


	&lt;pre&gt;&lt;code&gt;can i do it in a generic way.if anybody knows please help me in this regard.but any how i got all the keys and values .only my problem is how i assignn each key to value.it should be in genric way.i have search it but i do not get the right way.&lt;/code&gt;&lt;/pre&gt;</description>
      <pubDate>Fri, 11 Apr 2008 04:53:24 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:22:361:2572</guid>
      <author>Bishnu Prasadit pradipta Narayan Das</author>
      <link>https://forums.pragprog.com/forums/22/topics/361</link>
    </item>
  </channel>
</rss>
