Hello guys,
I am an old PHP guy. I have been using rails for a few months now. One
thing i have never udnerstood about rails is the way it handles nil
objects.
I have a form that can be used to insert data. The same form can also be
used to edit data. This edit data is stored in a session.
When a user fills out the form and clicks submit a new record is created
in the database and its also stored in the session. The user is then
taken to another form.
If the user clicks back to go the first form i wish for the data that
was just filled out to appear. That works fine if i do something liek
this.
<p><label for="details_name">Name</lablel><br>
<%= text_field("details", "name", "size" =>
40, :value =>
session[:exhibition].name ) %></p>
However with the above code i get a nil object error if the session is
not alreay set. How can i get around this? Is there a way to make rails
ignore the nil object and just output nothing like php does?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---