Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
saving ActiveRecord/form changes
Bill Butler
1/27/2009 2:26:00 PM
Greetings everyone,
I can't pass updated/changed values from the form elements to the
ActiveRecord. However something is going through because the table's
update_when column is registering the date/time of the update, but
otherwise no data revisions transpire. Have tried using form_for helper
as well, but the same results.
This is all new to me, so not sure what additional info will be
relevant. But am using Ruby 1.8.6 with a local MYSQL 5.1 database thru
a Radrails IDE. My apologies for whatever info I have ommitted. Any
suggestions on where I have gone astray will be most appreciated.
Thanks, Bill
CONTROLLER:
class FileController < ApplicationController
def edit
@file = File.find(params[:id])
end
def update
@file = File.find(params[:id])
if @file.update_attributes(params[:file])
redirect_to :action => 'show', :id => @file
else
render :action => 'edit'
end
end
end
VIEW:
<% form_tag (:action => 'update', :id => @file.id) do %>
<p><label for="file_description">Description</label><br>
<%= text_area 'file', 'description' </p>
<%= submit_tag 'Save changes' %>
<% end %>
<%= link_to 'Back', {:action => 'list'} %>
--
Posted via
http://www.ruby-...
.
1 Answer
Brian Candler
1/27/2009 2:54:00 PM
0
I'm afraid the Rails mailing lists/groups are elsewhere. This is the
Ruby programming language list.
However, as a quick guess: you should either be using form_tag with
text_area_tag, or form_for with text_area. There are plenty of sample
apps out there you can check against. Here's the one that got me
started:
http://www.onlamp.com/pub/a/onlamp/2006/12/14/revisiting-ruby-on-rails-revi...
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
saving ActiveRecord/form changes
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password