Re: empty emtry in database problem

supriya agarwal
Mon, 30 Jun 2008 13:15:43 -0000

im not setting it anywhere, it is just getting added through basic code of:

@device = Dev.new(@params[:dev])
and after that checking @device.save and then redirecting_to some page.

if im not entering anything nothing gets added. my point is it shud get
added as NULL in database. should''nt it??

On Mon, Jun 30, 2008 at 6:27 PM, Harold
<harold.gimenez-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

>
> You are probably setting the attribute to an empty string before
> saving the record/model instance. How is the attribute being
> populated?
>
> Empty string is still valid (not null)...
>
>
> On Jun 30, 8:15 am, "supriya agarwal"
<supriya.ii...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > sorry but that i alreayd tried.. not working .. still saving a field
as
> > empty in database.!! :(
> >
> > On Mon, Jun 30, 2008 at 5:28 PM, Sijo Kg <
> rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
> > wrote:
> >
> >
> >
> > > Hi
> > >  In migration file you can speciy like
> > > :null => true
> >
> > > If false, the underlying column has a not null constraint added
(if the
> > > database supports it).
> >
> > > You can use like
> > > t.column :name_last, :string, :null=>true     (for example)
> >
> > > And already migration file exists you can change column type
using
> > > change_column
> >
> > > Sijo
> > > --
> > > Posted viahttp://www.ruby-forum.com/.