Why isn't data being saved to the database?

I’m following an example in the “Head First Rails” book.

Now, when I “create” a record, and then go to the table, I find that a
BLANK record is created also I enter field values.

What may I be missing?

This is how “advs_controller.rb” looks like:

class AdvsController < ApplicationController
def show
@adv = Adv.find(params[:id])

def index
@advs = Adv.find(:all)

def new
@adv = Adv.new(params[:ad])

def create
@adv = Adv.new(params[:ad])


I don’t know your view’s code, but looking at your controller’s code…
maybe instead of params[:ad] you should use params[:adv] “maybe” I’m
guessing. you should send your view’s code

2010/8/20 Abder-Rahman A. [email protected]

Thanks a lot Sergio. You are correct. It should have been:

@adv = Adv.save(params[:adv])

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