U can use a simple new method to return attribute.to_s (nil.to_s returns
a blank string)
I don''t think there is a direct way to read a nil value from the
database in
an attribute.. and then directly expecting the attribute value to be a blank
string.
If null doesn''t mean anything to u, U can simply modify the database
column
to not accept null values and make the default blank string. Not sure if
that works with oracle but i would have tried it.
Good luck
On Tue, Oct 14, 2008 at 12:10 AM, Don.Mc
<Don.McClean-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> When an empty string is stored in Oracle, it is converted to a null.
> When I retrieve it with rails, I get a nil object.
>
> I would like to modify my Rails model to return an empty string
> instead of
> null for that attribute, instead of modifying code in multiple places.
> Is
> that easily doable? I tried an alias, but that did not work.
>
> Thanks in Advance,
> Don Mc
> >
>
--
Mahmoud Said
Software Developer
blog.modsaid.com
www.eSpace.com.eg
+20-16-1223857
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---