# Define\_method with parameters

**URL:** <https://www.ruby-forum.com/t/define-method-with-parameters/50342>\
**Category:** Rails\
**Created:** [December 15, 2005, 2:51pm UTC](https://www.ruby-forum.com/t/define-method-with-parameters/50342 "2005-12-15T14:51:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![halfgaar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/ea666f/32.png) [@halfgaar](https://www.ruby-forum.com/u/halfgaar)\
**Post date:** [December 15, 2005, 2:51pm UTC](https://www.ruby-forum.com/t/define-method-with-parameters/50342/1 "2005-12-15T14:51:29Z")

</div>

Hi,

I’m trying to write a macro which defines methods. One of these should  
have a parameter, but I can’t get that to work. Something like:

define\_method(“printstuff”) do  
puts “blabla”  
end

works fine. But, how do I use define\_method to create something like:

def printstuff(the\_stuff)  
puts the\_stuff  
end

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![halfgaar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/ea666f/32.png) [@halfgaar](https://www.ruby-forum.com/u/halfgaar)\
**Post date:** [December 15, 2005, 3:24pm UTC](https://www.ruby-forum.com/t/define-method-with-parameters/50342/2 "2005-12-15T15:24:40Z")

</div>

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

---

<div class="post-metadata">

**Author:** ![halfgaar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/ea666f/32.png) [@halfgaar](https://www.ruby-forum.com/u/halfgaar)\
**Post date:** [December 15, 2005, 3:49pm UTC](https://www.ruby-forum.com/t/define-method-with-parameters/50342/3 "2005-12-15T15:49:26Z")

</div>

Jack C. wrote:

> 

Is there something wrong with the forum-to-list gateway, or is your  
reply actually empty?

---

<div class="post-metadata">

**Author:** ![halfgaar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/ea666f/32.png) [@halfgaar](https://www.ruby-forum.com/u/halfgaar)\
**Post date:** [December 15, 2005, 7:22pm UTC](https://www.ruby-forum.com/t/define-method-with-parameters/50342/4 "2005-12-15T19:22:18Z")

</div>

On 12/15/05, Wiebe C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Jack C. wrote:
> 
> > 
> 
> Is there something wrong with the forum-to-list gateway, or is your  
> reply actually empty?
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

Something must be wrong with the forum-to-list gateway, since I can  
see his relpy just fine.

- Rowan
