rails adding junk into db

Scott Pn wrote:

I am having a problem where I am getting data from a form and when it
get puts into the database there is extra unwanted junk there, and I
don't know why it is doing it. Has anyone had any problems like this?

Anything that is saved in the database would be going through any validations and filters that you put in place.

Perhaps you could elaborate on what "junk" is.

Robby

it puts in --- - ?
you mean dashes? and where does it put that in? what column? what
column type? what does your model and controller code look like?

We're no mindreaders mister :wink:

Scott Pn wrote:

Oh yeah I should mention it puts "|---- - comment here" into the db table (to be a little more precise on what I meant by junk).

That string is coming from somewhere. I'm guessing it's a mistyped HTML comment in one of your view files. Look at the HTML source of the page after its been rendered by Rails to see where that string is on the page and work back from there or just rgrep the directory to find it.

Scott Pn wrote:

    <%= text_area :comment, params[:comment], :value => '', :cols => "55", :rows => "6" %><br />

This should instead be text_area_tag.

Scoff, this is a key time to decouple.

write some model(unit) tests. The tests 'should' verify the results of a save.

then write a controller(functional) spec. Will do the same, but test your controller layer.

these 2 tests will be guaranteed to give you the symptoms you need to lick this bug (eww) dead.

cheers,
Jodi

That looks like the start of a YAML document. Is the column serialised?
Maybe AR is doing something funky because the column name is the same as
the model name?

Hi Scott,

Scott Pn wrote:

And to Tore Darell or anyone really:

Speaking for 'anyone' ...:wink:

What do you mean by AR?

ActiveRecord

Best regards,
Bill