[Rails] inserting value got problem

Martin Stabenfeldt
Mon, 24 Apr 2006 10:32:07 -0000

Hi,

On Apr 18, 2006, at 1:50 PM, parikshit wrote:
> Parameters:
{"bestandsliste"=>{"typ"=>"bumffer",
> "KundanName"=>"parikshit",
"Abgeholt"=>"", "LieferLand"=>"",
> "Kaufmann"=>"birla",
"Marge"=>"", "Erzieltervk"=>"",
> "LieferOrt"=>"",
"Hersteller"=>"birla"},
"commit"=>"Verkaufsliste",
>
"verkaufsliste"=>{"vkdatum(1i)"=>"2006",
"vkdatum(2i)"=>"4",
> "vkdatum(3i)"=>"18",
"vkdatum(4i)"=>"17",
"vkdatum(5i)"=>"12"}}
>
> hi every body i want to insert above value but cant able to insert
> date  how i can do that.
> plese reply me i juct do this in my controller
> if request.post?
>     @verkaufsliste = Verkaufsliste.new(@params[:bestandsliste])
>
> end     if @verkaufsliste.save      redirect_to :action =>
''list''
> else
>   render :action => ''sale''
> end
> end

Try @verkaufsliste = Verkaufsliste.new(params[:bestandsliste])


I collect the information I want to add to the database in a form
like this:
<label
for="number_number">Number
<%= text_field ''number'', ''number''
%>

Name
<%= text_field ''number'', ''name''
%>

"name" and "number" is the names of the fields in the
database.

   def create
     @number = Number.new(params[:number])

     if @number.save
       flash[:notice] = ''Number was successfully created.''
       redirect_to :action => ''list''
     else
       render :action => ''new''
     end
   end

Hope this helps!

Regards,
Martin Stabenfeldt