# Override form data

**URL:** <https://www.ruby-forum.com/t/override-form-data/48181>\
**Category:** Rails\
**Created:** [November 17, 2005, 4:05pm UTC](https://www.ruby-forum.com/t/override-form-data/48181 "2005-11-17T16:05:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rbrant](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/49beb7/32.png) [@rbrant](https://www.ruby-forum.com/u/rbrant)\
**Post date:** [November 17, 2005, 4:05pm UTC](https://www.ruby-forum.com/t/override-form-data/48181/1 "2005-11-17T16:05:41Z")

</div>

would anyone be willing to provide a code sample demonstrating how to  
override form field data, or simply the best way and place to access  
it before action is taken on it? A link to an example would be great  
as well.

thanks,  
rich

---

<div class="post-metadata">

**Author:** ![rbrant](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/49beb7/32.png) [@rbrant](https://www.ruby-forum.com/u/rbrant)\
**Post date:** [November 17, 2005, 9:32pm UTC](https://www.ruby-forum.com/t/override-form-data/48181/2 "2005-11-17T21:32:13Z")

</div>

On Thursday 17 November 2005 22:05, Rich B. wrote:

> would anyone be willing to provide a code sample demonstrating how  
> to override form field data, or simply the best way and place to  
> access it before action is taken on it? A link to an example would  
> be great as well.  
> If I understood what you meant correctly, then something like this  
> should work:

class MyController \< ApplicationController

before\_filter :convert\_timezone, :only =\> [:create]

def create  
# here @params[:timezone] is already an instance of TimeZone  
end

def convert\_timezone  
return unless @params[:timezone]  
@params[:timezone] = TimeZone.new(@params[:timezone])  
end  
end

Hope that helps
