# What does =\> mean?

**URL:** <https://www.ruby-forum.com/t/what-does-mean/96459>\
**Category:** Rails\
**Created:** [June 28, 2006, 9:49pm UTC](https://www.ruby-forum.com/t/what-does-mean/96459 "2006-06-28T21:49:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tripdragon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a88e4f/32.png) [@tripdragon](https://www.ruby-forum.com/u/tripdragon)\
**Post date:** [June 28, 2006, 9:49pm UTC](https://www.ruby-forum.com/t/what-does-mean/96459/1 "2006-06-28T21:49:52Z")

</div>

I see =\> is a hash in ruby so is # , errrg But then I see in Rails  
#=\>  
and then  
render :action =\> ‘list.rhtml’

and other uses to it , I just need some sort of definition to what it  
mean, is it redirect send\_to ‘then’ no wait : is then , help…

---

<div class="post-metadata">

**Author:** ![tripdragon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a88e4f/32.png) [@tripdragon](https://www.ruby-forum.com/u/tripdragon)\
**Post date:** [June 28, 2006, 10:00pm UTC](https://www.ruby-forum.com/t/what-does-mean/96459/2 "2006-06-28T22:00:31Z")

</div>

trip dragon wrote:

> I see =\> is a hash in ruby so is # , errrg But then I see in Rails  
> #=\>  
> and then  
> render :action =\> ‘list.rhtml’
> 
> and other uses to it , I just need some sort of definition to what it  
> mean, is it redirect send\_to ‘then’ no wait : is then , help…

When creating a hash, =\> is used to relate the keys to the values.

Anywhere you see =\>, a hash is being created. Lots of Rails methods  
take hashes as input.

Wes

---

<div class="post-metadata">

**Author:** ![tripdragon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a88e4f/32.png) [@tripdragon](https://www.ruby-forum.com/u/tripdragon)\
**Post date:** [June 28, 2006, 10:20pm UTC](https://www.ruby-forum.com/t/what-does-mean/96459/3 "2006-06-28T22:20:37Z")

</div>

Ah! many thanks! …

mhh note to self need more books… and need to make a real cheat sheet

---

<div class="post-metadata">

**Author:** ![tripdragon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a88e4f/32.png) [@tripdragon](https://www.ruby-forum.com/u/tripdragon)\
**Post date:** [June 29, 2006, 2:29am UTC](https://www.ruby-forum.com/t/what-does-mean/96459/4 "2006-06-29T02:29:09Z")

</div>

Wes G. wrote:

> trip dragon wrote:
> 
> > I see =\> is a hash in ruby so is # , errrg But then I see in Rails  
> > #=\>  
> > and then  
> > render :action =\> ‘list.rhtml’
> > 
> > and other uses to it , I just need some sort of definition to what it  
> > mean, is it redirect send\_to ‘then’ no wait : is then , help…
> 
> When creating a hash, =\> is used to relate the keys to the values.
> 
> Anywhere you see =\>, a hash is being created. Lots of Rails methods  
> take hashes as input.
> 
> Wes

Also you should know that hashes provided to method calls don’t always  
need the {}'s around it to be a hash. For example, lets say I have a  
method foo:

def foo(name, options = {})  
puts “#{name} is #{options[:is]}”  
end

Now as long the hash is the last element in the method arguments then  
you can just string key/value pairs along as if they where individual  
arguments:

foo(‘Sally’, :is =\> ‘hot’)

produces: Sally is hot

Which is exactly the same as:

foo(‘Sally’, {:is =\> ‘hot’})

So anytime you see a =\> remember its a hash and mentally put {}'s around  
it. So in your example, render method excepts a hash.

render :action =\> ‘list.rhtml’

is the same as

render {:action =\> ‘list.rhtml’}

---

<div class="post-metadata">

**Author:** ![tripdragon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a88e4f/32.png) [@tripdragon](https://www.ruby-forum.com/u/tripdragon)\
**Post date:** [June 28, 2006, 10:33pm UTC](https://www.ruby-forum.com/t/what-does-mean/96459/5 "2006-06-28T22:33:38Z")

</div>

trip dragon wrote:

> Ah! many thanks! …
> 
> mhh note to self need more books… and need to make a real cheat sheet

You need the following books:

Programming Ruby - Thomas (“pickaxe”)  
Ruby for Rails - Black  
Agile Web D. with Rails - Thomas, Heinemeier H. (2nd ed.)  
[optional: Rails Recipes - Fowler]

plus a browser and a little patience, and you’ll be all set.

Good luck! It’s a lot of fun once you get into it.

Wes
