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 <p><label for="trade_tradedate">Trade Date</label><br/> <%= date_select ''trade'', ''tradedate'', :order => [:month, :day, :year]%></p> <p><label for="position_symbol">Symbol</label><br/> <%= text_field ''position'', ''symbol'' %></p> # 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 ... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Al Evans
2006-Nov-02 15:38 UTC
Re: accessing single parameter in params (date in particular
Mark Yea 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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
@tradedate = params[:trade][:tradedate] @symbol = params[:position][:symbol] ------------- Best Regards, Sergey --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---