saving ActiveRecord/form changes

Discussion in 'Ruby' started by Bill Butler, Jan 27, 2009.

  1. Bill Butler

    Bill Butler Guest

    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-forum.com/.
     
    Bill Butler, Jan 27, 2009
    #1
    1. Advertising

  2. Brian Candler, Jan 27, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    307
    John O'Conner
    Jan 3, 2007
  2. Daniel Klein

    Problem saving changes in MoinMoin pages

    Daniel Klein, Feb 1, 2007, in forum: Python
    Replies:
    1
    Views:
    272
  3. Chess Club

    Saving changes to path

    Chess Club, Jul 19, 2011, in forum: Python
    Replies:
    2
    Views:
    184
    Ethan Furman
    Jul 19, 2011
  4. Buzz
    Replies:
    4
    Views:
    184
  5. Dave Burt

    ActiveRecord: casting and saving

    Dave Burt, Mar 6, 2005, in forum: Ruby
    Replies:
    1
    Views:
    89
    Dave Burt
    Mar 6, 2005
Loading...

Share This Page