I''m just getting into ror and am reading lots of books on it right now. However, I ahve this question which I ahve been unable to solve. It''s in regard to Views/Controllers. Inside a Person view I have the snippet "<%= Home.find_by_id(home_id).type%>". Now, in books I''ve been reading, they write similar things only they''d be using an instance variable in the related Person controller and then calling that instance variable from the view (like "<= @homeType=>". Is that what I should be doing instead? Why? It would seem that doing it the way I was at first above, I am saving it from having to create a usless variable and taking up more memory space (however minimal it may be). Also, Looking at the first code above, why can I access the Home controller from inside the Person View (I assume that''s what I''m doing with that as I''m still trying to understand all of this dynamic relationship stuff). Thanks for any help provided! -- 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 -~----------~----~----~----~------~----~------~--~---
The whole point of MVC is to abstract the logic out of views into the controllers and models, i would continue your reading!! Tim -- 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 -~----------~----~----~----~------~----~------~--~---
> I''m just getting into ror and am reading lots of books on it right now. > However, I ahve this question which I ahve been unable to solve. It''s in > regard to Views/Controllers. Inside a Person view I have the snippet > "<%= Home.find_by_id(home_id).type%>". Now, in books I''ve been reading, > they write similar things only they''d be using an instance variable in > the related Person controller and then calling that instance variable > from the view (like "<= @homeType=>". Is that what I should be doing > instead? Why? It would seem that doing it the way I was at first above, > I am saving it from having to create a usless variable and taking up > more memory space (however minimal it may be). Also, Looking at the > first code above, why can I access the Home controller from inside the > Person View (I assume that''s what I''m doing with that as I''m still > trying to understand all of this dynamic relationship stuff). Thanks for > any help provided!Your point about saving memory is valid, but the whole idea of MVC is that the view, as far as possible should not contain any business logic or otherwise be strongly coupled to your data. In other words, it doesn''t and shouldn''t need to know where homeType comes from, it should just display it as and when required. If you use an instance variable you can make major changes to the code which gives the value of homeType and your view need not change. All in all it outweighs the value of saving a couple bytes of memory. Hope this helps, Matt. --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Matthew Law wrote:>> first code above, why can I access the Home controller from inside the >> Person View (I assume that''s what I''m doing with that as I''m still >> trying to understand all of this dynamic relationship stuff). Thanks for >> any help provided! > > Your point about saving memory is valid, but the whole idea of MVC is > that > the view, as far as possible should not contain any business logic or > otherwise be strongly coupled to your data. In other words, it doesn''t > and shouldn''t need to know where homeType comes from, it should just > display it as and when required. > > If you use an instance variable you can make major changes to the code > which gives the value of homeType and your view need not change. All in > all it outweighs the value of saving a couple bytes of memory. > > Hope this helps, > > Matt.Excellent. That does help. For some reason when I was coding this, I was in memory saving mode and not good SE Principle mode. I will try my best to remember to design this way now. Thanks! -- 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 -~----------~----~----~----~------~----~------~--~---
Hey I can''t seem to get this simple DRb client to access the server over my network... I get a bad file descriptor error. ############# The Client Script ################ require ''drb'' DRb.start_service server = DRbObject.new(nil, "druby://#{ARGV.shift}") my_id = server.initialize_me puts my_id ############# The Server Script ############### require ''drb'' class PerformAlexaUpdate def initialize_me return ''hello'' end end h_server = DRb::DRbServer.new ''druby://127.0.0.1:5555'', PerformAlexaUpdate.new h_server.thread.join ########################################### Any ideas will be greatly appreciated! Thanks in advance, Gustav --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---