List Info

Thread: Re: interesting question (possibly)




Re: interesting question (possibly)
country flaguser name
United States
2007-06-27 07:32:01
Hi Dave,

I understand how your solution would work now. Let me play
with it a
little bit longer to see if I forgot something.

Answering your question though, yes, I did remove the line
of code
that removed site_id from the hash.

Thank you for the follow-up!


--~--~---------~--~----~------------~-------~--~----~
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-talkgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: interesting question (possibly)
country flaguser name
United States
2007-06-27 19:06:42
All right, I've done more testing with attr_accessor
:site_id. My
latest finding is that site_id IS returned upon an error in
the
validation, BUT the site select doesn't restore the
selection. I have
my site select defined as follows:

<%= select(:equipment, :site_id,
Site.list(session[:customer_id]),
{ :include_blank => 'true' }) %>

I have no idea how the selection is not maintained if
equipment.site_id does contain the value that I submitted.

Also, I forgot to mention that I WOULD like to have site_id
as a model
method for equipment. I have it defined as:

def site_id
    if self.building
      return self.building.site.id
    else
      nil
    end
end

So, instead of attr_acessor :site_id, I decided to go with
attr_writer :site_id. But here's the interesting part, if I
do it that
way, I don't get the site_id back upon an error. But I do
get it back
when I use attr_accessor. I don't understand it at all.

Any ideas? This is not such a big deal, but I'm very curious
how to do
it elegantly.


--~--~---------~--~----~------------~-------~--~----~
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-talkgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )