Getting Parameter when Form_for is Submitted

This is slightly tied with my previous post. I wasn’t sure if I was
supposed to make another message in there, so I made a new post.

So in my previous post I accidentally asked a pure ruby question about
gsub which I’ll be using in this question.

Anyways, what I want to do is to take a single parameter from user’s
input in the Form_for and run it through the gsub code [ @file_cut =
order.gsub(/[\w ! # $ % ^ & * + -]+.doc$/, '*.doc) ] when the user
submits the form. The parameter will still be stored in the database
so I don’t think test_field_tag, etc. will help me unless you think
otherwise. Also, I’m hoping not to use javascript in my code.

Here’s my code:

orders_controller.rb

class OrdersController < ApplicationController

GET /orders

GET /orders.xml

def index
@orders = Order.all

respond_to do |format|
  format.html # index.html.erb
  format.xml  { render :xml => @orders }
end

end

GET /orders/1

GET /orders/1.xml

def show
@order = Order.find(params[:id])

#@try = params[:file]
# A failed attempt

respond_to do |format|
  format.html # show.html.erb
  format.xml  { render :xml => @order }
end

end

GET /orders/new

GET /orders/new.xml

def new
@order = Order.new

respond_to do |format|
  format.html # new.html.erb
  format.xml  { render :xml => @order }
end

end

POST /orders

POST /orders.xml

def create
@order = Order.new(params[:order])

#order = params[:file]
#@file_cut = order.gsub(/[\w ! # $ % ^ & * + -]+\.doc$/, '*.doc)
#have tried to implement the code here


respond_to do |format|
  if @order.save
    format.html { redirect_to(@order, :notice => "Order was

successfully created.") }
format.xml { render :xml => @order, :status
=> :created, :location => @order }
#/display
else
format.html { render :action => “new” }
format.xml { render :xml => @order.errors, :status
=> :unprocessable_entity }
end
end
end

DELETE /orders/1

DELETE /orders/1.xml

def destroy
@order = Order.find(params[:id])
@order.destroy

respond_to do |format|
  format.html { redirect_to(orders_url) }
  format.xml  { head :ok }
end

end
end

new.html.erb

New Order

<% form_for(@order) do |f| %>
<%= f.error_messages %>

<%= f.label :name, "Your N." %>
<%=h f.text_field :name %>

<%= f.label :file%>
<%=h f.file_field :file%>

<%= f.label :email, "Your Email" %>
<%=h f.text_field :email %>

<%= f.submit 'Create' %>

<% end %>

<%= link_to ‘Back’, orders_path %>

Thank you for taking the time to read,
Anon_comp