# Function calling in RoR

**URL:** <https://www.ruby-forum.com/t/function-calling-in-ror/142184>\
**Category:** Rails\
**Created:** [July 4, 2008, 9:04am UTC](https://www.ruby-forum.com/t/function-calling-in-ror/142184 "2008-07-04T09:04:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jokrish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8edcca/32.png) [@jokrish](https://www.ruby-forum.com/u/jokrish)\
**Post date:** [July 4, 2008, 9:04am UTC](https://www.ruby-forum.com/t/function-calling-in-ror/142184/1 "2008-07-04T09:04:56Z")

</div>

i m new in RoR…I have created a function in my controller  
def create\_by  
…  
end  
.how can i call this one by using a link …ie from my view this  
function should be called when clicking on some field like name…

so in my index how can i call this function using a link  
.

\<%= link\_to \_created\_by ‘name’ %\>…  
i have used this…but getting errors…can anybody help me…

---

<div class="post-metadata">

**Author:** ![jokrish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8edcca/32.png) [@jokrish](https://www.ruby-forum.com/u/jokrish)\
**Post date:** [July 4, 2008, 9:09am UTC](https://www.ruby-forum.com/t/function-calling-in-ror/142184/2 "2008-07-04T09:09:02Z")

</div>

:o  
u can call like  
\<%= link\_to “Name” controller\_path %\>

---

<div class="post-metadata">

**Author:** ![jokrish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8edcca/32.png) [@jokrish](https://www.ruby-forum.com/u/jokrish)\
**Post date:** [July 4, 2008, 10:23am UTC](https://www.ruby-forum.com/t/function-calling-in-ror/142184/3 "2008-07-04T10:23:28Z")

</div>

or in other words

:link\_to model.name, :controller =\> ‘controllername’, :action =\>  
‘create\_by’

controller functions dont accept arguments. so calling your function  
like link\_to \_created\_by ‘name’ is wrong for several reasons:

1. you misspelled your function name \_create\_by instead of create\_by
2. you passed name as an argument (you should use params)

j

On Jul 4, 8:08 am, “bala kishore pulicherla” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
