<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: ActiveRecord Object to Hash assignment in Ruby on Rails</title>
	<atom:link href="http://jigyasamakkar.com/activerecord-object-to-hash-assignment-in-ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://jigyasamakkar.com/activerecord-object-to-hash-assignment-in-ruby-on-rails/</link>
	<description>Ruby on Rails Developer</description>
	<lastBuildDate>Wed, 11 Jan 2012 19:54:14 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Alex Mercer</title>
		<link>http://jigyasamakkar.com/activerecord-object-to-hash-assignment-in-ruby-on-rails/comment-page-1/#comment-183</link>
		<dc:creator>Alex Mercer</dc:creator>
		<pubDate>Wed, 11 Jan 2012 19:54:14 +0000</pubDate>
		<guid isPermaLink="false">http://jigyasamakkar.com/?p=198#comment-183</guid>
		<description>you can use hash in more simplier way.. with `except` method

instead of:
  desired_keys = [&#039;address&#039; , &#039;zipcode&#039; , &#039;city&#039; , &#039;country&#039;]
  local_array = session_user.attributes.select{&#124;key,value&#124; desired_keys.include?(key) }
  local_hash = Hash[*local_array.flatten]

you can use:
  # &#039;name&#039;, &#039;id&#039; - fields that you don&#039;t wanna to see in `local_hash`
  local_hash = session_user.attributes.except(&#039;name&#039;, &#039;id&#039;)</description>
		<content:encoded><![CDATA[<p>you can use hash in more simplier way.. with `except` method</p>
<p>instead of:<br />
  desired_keys = ['address' , 'zipcode' , 'city' , 'country']<br />
  local_array = session_user.attributes.select{|key,value| desired_keys.include?(key) }<br />
  local_hash = Hash[*local_array.flatten]</p>
<p>you can use:<br />
  # &#8216;name&#8217;, &#8216;id&#8217; &#8211; fields that you don&#8217;t wanna to see in `local_hash`<br />
  local_hash = session_user.attributes.except(&#8216;name&#8217;, &#8216;id&#8217;)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

