Rails inserting NULL values instead of actual values

I have an odd issue that I am having a difficult time solving.

When I attempt to create or edit data in my rails app; it INSERTs NULL
values instead of the values I eintered in the form. Same with editing
the data; it doesn’t UPDATE the table with values I entered. Via the
console, I can see that it recieved the values but the SQL statements
show NULL values.

I don’t know where my problem lies. Here’s my code below. Any help
would be greatly appreciated. Thanks!

Console error
http://dpaste.com/90452/

meetmes_controller.rb
http://dpaste.com/90453/

meetme.rb Model (nothing in here)
http://dpaste.com/90454/

meetme view (new)
http://dpaste.com/90455/

meetme view (edit)
http://dpaste.com/90456/

Michael

On Sun, Sep 6, 2009 at 3:59 PM, Michael R[email protected]
wrote:

When I attempt to create or edit data in my rails app; it INSERTs NULL
values instead of the values I eintered in the form.

meetmes_controller.rb

def create
@meetme = Meetme.new(params[:meetmes])

meetme view (new)

<% form_for(@meetme) do |f| %>

Singular/plural mismatch? that is, shouldn’t it be
@meetme = Meetme.new(params[:meetme]) # to match your form


Hassan S. ------------------------ [email protected]
twitter: @hassan

Hello Micheal,

when using formfor, the returned parameter’s name is the same as the
model’s name, but in your create action you are retrieving “meetmes”
instead of “meetme” from the parameters (which is nil) so the new
method would instantiate an empty model and then try to save it.

try this create action instead of the one you have:

def create
@meetme = Meetme.new(params[:meetme]) # notice this line

respond_to do |format|
  if @meetme.save
    flash[:notice] = 'Meetmes was successfully created.'
    format.html { redirect_to(@meetme) }
    format.xml  { render :xml => @meetme, :status

=> :created, :location => @meetme }
else
format.html { render :action => “new” }
format.xml { render :xml => @meetme.errors, :status
=> :unprocessable_entity }
end
end
end

Cheers…

Thanks Hasson, cousine! That fixed my problem. I appreciate the quick
responses.

Michael

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs