# Saving form fields not working

**URL:** <https://www.ruby-forum.com/t/saving-form-fields-not-working/134472>\
**Category:** Ruby\
**Created:** [April 11, 2008, 6:39am UTC](https://www.ruby-forum.com/t/saving-form-fields-not-working/134472 "2008-04-11T06:39:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajatgarg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a183cd/32.png) [@rajatgarg](https://www.ruby-forum.com/u/rajatgarg)\
**Post date:** [April 11, 2008, 6:39am UTC](https://www.ruby-forum.com/t/saving-form-fields-not-working/134472/1 "2008-04-11T06:39:36Z")

</div>

I have a form on a page _add\_flight.rhtml -_  
\<%=form\_tag({:controller=\>“local\_flights”,:action=\>“shared”},  
{:id=\>“add\_flight”, :method=\>“post”})%\>  
…  
\<%=submit\_tag(“Add your Flight Request”)%\>

Then,\* in controller - \*  
def shared  
\_flt = params[:fltAvailable]  
if !\_flt.blank?  
@flt = SharedLocalFlight.new(\_flt)  
@flt.save  
end  
@fltSharedList = SharedLocalFlight.find(:all)  
end

> > This seems to be getting called and then shared.rhtml gets rendered

However, record doesn’t get saved to table. There is no error msg in  
development.log.

Any ideas on what I am missing here?

Please help.

## Thanks,

Rajat G.

Ph: 206-499-9495  
Add: 1314 Spring Street, #412  
Seattle, WA 98104  
Web: [http://www.pilotoutlook.com](http://www.pilotoutlook.com)

---

<div class="post-metadata">

**Author:** ![rajatgarg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a183cd/32.png) [@rajatgarg](https://www.ruby-forum.com/u/rajatgarg)\
**Post date:** [April 11, 2008, 6:50am UTC](https://www.ruby-forum.com/t/saving-form-fields-not-working/134472/2 "2008-04-11T06:50:42Z")

</div>

I think the problem is with

params[:fltAvailable]

where did you come up with this?

may I suggest (temporarily) replacing shared with this:

def shared  
render :text =\> params.to\_yaml  
end

and then looking at your html source. It’ll show you what the params  
key SHOULD be.

Julian

Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)  
VIDEO #3 out NOW!  
[http://sensei.zenunit.com/](http://sensei.zenunit.com/)

---

<div class="post-metadata">

**Author:** ![rajatgarg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a183cd/32.png) [@rajatgarg](https://www.ruby-forum.com/u/rajatgarg)\
**Post date:** [April 11, 2008, 6:52am UTC](https://www.ruby-forum.com/t/saving-form-fields-not-working/134472/3 "2008-04-11T06:52:28Z")

</div>

By the way, this question should be asked of the rails list, not the  
ruby one.

Julian.

Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)  
VIDEO #3 out NOW!  
[http://sensei.zenunit.com/](http://sensei.zenunit.com/)

---

<div class="post-metadata">

**Author:** ![rajatgarg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a183cd/32.png) [@rajatgarg](https://www.ruby-forum.com/u/rajatgarg)\
**Post date:** [April 11, 2008, 3:12pm UTC](https://www.ruby-forum.com/t/saving-form-fields-not-working/134472/4 "2008-04-11T15:12:07Z")

</div>

Julian,

I get back -

— !map:HashWithIndifferentAccess  
commit: List your Flight  
action: shared  
fltAvailable: !map:HashWithIndifferentAccess  
from\_airport: BFI  
cost\_type: Cost per person  
num\_seats: “3”  
estimated\_flying\_time: “1:00”  
estimated\_cost: “45”  
model\_name: “”  
return\_time: 9:00 AM  
description: lslkdslks  
mfr\_name: “”  
from\_time: 9:00 AM  
return\_date: “2008-04-16”  
from\_date: “2008-04-11”  
to\_airport: HQM  
aircraft\_id: “73838”  
flight\_type: One Way

controller: local\_flights

Any ideas what the issue is?

PS: What’s the list name for Rails ?

Thanks,

On Thu, Apr 10, 2008 at 9:50 PM, Julian L.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> On 11/04/2008, at 2:38 PM, Rajat G. wrote:
> 
> > \_flt = params[:fltAvailable]  
> > However, record doesn’t get saved to table. There is no error msg in

–  
Rajat G.

Ph: 206-499-9495  
Add: 1314 Spring Street, #412  
Seattle, WA 98104  
Web: [http://www.pilotoutlook.com](http://www.pilotoutlook.com)
