Accessing single parameter in params (date in particular)

I have a form that is passing a “date” to a controller and I need to
just get access to the date?

Here is a snippet from the form

Trade Date
<%= date_select 'trade', 'tradedate', :order => [:month, :day, :year]%>

Symbol
<%= text_field 'position', 'symbol' %>

Here is a snippet from the table definition

class Trades < ActiveRecord::Migration
def self.up
create_table :trades do |table|
table.column :tradedate, :date

end

Here is snippet in the controller where I am attempting as follows

@position.trades.create( :tradedate => params[:trade],
:symbol => @position.symbol,

I can see in the log that it’s passing the parameter as follows

“trade”=>{“tradedate(1i)”=>“2006”, “tradedate(2i)”=>“11”,
“tradedate(3i)”=>“1”}

thanks for any help …

Mark Y. wrote:

I can see in the log that it’s passing the parameter as follows

“trade”=>{“tradedate(1i)”=>“2006”, “tradedate(2i)”=>“11”,
“tradedate(3i)”=>“1”}

thanks for any help …

t = Time.local(params[‘trade’][‘tradedate(1i)’],
params[‘trade’][‘tradedate(2i)’],
params[‘trade’][‘tradedate(3i)’])

Ought to do it, modulo any typos I’ve introduced.

–Al Evans

@tradedate = params[:trade][:tradedate]
@symbol = params[:position][:symbol]


Best Regards, Sergey