# Callbacks with parameters

**URL:** <https://www.ruby-forum.com/t/callbacks-with-parameters/109316>\
**Category:** Rails\
**Created:** [July 13, 2007, 11:45am UTC](https://www.ruby-forum.com/t/callbacks-with-parameters/109316 "2007-07-13T11:45:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jotape](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c77e96/32.png) [@jotape](https://www.ruby-forum.com/u/jotape)\
**Post date:** [July 13, 2007, 11:45am UTC](https://www.ruby-forum.com/t/callbacks-with-parameters/109316/1 "2007-07-13T11:45:29Z")

</div>

Hello.

I need to pass a user\_id that I have in a session var to a before\_save  
callback. Is it possible?

Thanks

---

<div class="post-metadata">

**Author:** ![jotape](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c77e96/32.png) [@jotape](https://www.ruby-forum.com/u/jotape)\
**Post date:** [July 13, 2007, 12:21pm UTC](https://www.ruby-forum.com/t/callbacks-with-parameters/109316/2 "2007-07-13T12:21:05Z")

</div>

Pedro C. wrote:

> I need to pass a user\_id that I have in a session var to a before\_save  
> callback. Is it possible?

Best way would be to add a user\_id attr\_accessor to the model,  
and to set and access that.

–  
We develop, watch us RoR, in numbers too big to ignore.

---

<div class="post-metadata">

**Author:** ![jotape](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c77e96/32.png) [@jotape](https://www.ruby-forum.com/u/jotape)\
**Post date:** [July 13, 2007, 12:24pm UTC](https://www.ruby-forum.com/t/callbacks-with-parameters/109316/3 "2007-07-13T12:24:25Z")

</div>

Thanks… I will do just that…
