Jason Vogel
2006-Dec-18 15:37 UTC
MVC... Issues with Models (2nd attempt at post...previous lost?)
I''m new to Ruby and RoR. I written a small app that has gotten my feet wet. I have a question about Models. Controllers, I''m good. Views and Partials, I''m good. Okay, so Models hold data. Models have the ability to query the database to access and change data. Model changes are only picked up after server restart unlike everybody else... what? Most of my changes seem to be here. My controllers just say go here next and show this view. The real work, validation, business logic, ... all seems to be in the Models. One of the first things that got me interested in Ruby / RoR was avoiding the recompile/restart world of Java/C#. So am I doing something wrong? It''s almost like I''m looking for MVCL (Model - DataLayer ONLY, View [Presentation], Controller, and Logic). Thanks, Jason --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Phlip
2006-Dec-18 15:52 UTC
Re: MVC... Issues with Models (2nd attempt at post...previous lost?)
Jason Vogel wrote:> Okay, so Models hold data. Models have the ability to query the > database to access and change data. Model changes are only picked up > after server restart unlike everybody else... what?What? To change a model''s link to the database (correct me if I''m wrong) you edit stuff in db/migrate, run ''rake migrate'' (?), run your tests (!), and hit your application''s pages. The new models are there. I do this all the time (with a SQLite backend for development). To change a model''s class, I ... change the class, run the tests, and hit the application''s pages. The changes are there. I frequently tweak code in any layer and instantly click on my pages'' links. The new action versions are all just there.> Most of my changes > seem to be here.That could be a design smell. Do most of your models'' methods reach out to other models?> My controllers just say go here next and show this > view. The real work, validation, business logic, ... all seems to be > in the Models. One of the first things that got me interested in Ruby > / RoR was avoiding the recompile/restart world of Java/C#. So am I > doing something wrong? It''s almost like I''m looking for MVCL (Model - > DataLayer ONLY, View [Presentation], Controller, and Logic).Are you stopping and starting the server after each change? don''t do that. Are you writing more unit tests than production code? Set your editor up to run such tests from one button. (I remember my nightmare days with Tomcat, and I suspect that anyone burned by that gawd-awful system might have trouble thinking inside Rails''s capacious box!) -- Phlip http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
dblack-TKXtfPMJ4Ozk1uMJSBkQmQ@public.gmane.org
2006-Dec-18 16:04 UTC
Re: MVC... Issues with Models (2nd attempt at post...previous lost?)
Hi -- On Mon, 18 Dec 2006, Jason Vogel wrote:> > I''m new to Ruby and RoR. I written a small app that has gotten my feet > wet.Welcome!> I have a question about Models. Controllers, I''m good. Views and > Partials, I''m good. > > Okay, so Models hold data. Models have the ability to query the > database to access and change data. Model changes are only picked up > after server restart unlike everybody else... what? Most of my changes > seem to be here. My controllers just say go here next and show this > view. The real work, validation, business logic, ... all seems to be > in the Models. One of the first things that got me interested in Ruby > / RoR was avoiding the recompile/restart world of Java/C#. So am I > doing something wrong? It''s almost like I''m looking for MVCL (Model - > DataLayer ONLY, View [Presentation], Controller, and Logic).What Rails environment are you running in? In development mode you should see everything, including models, getting reloaded. In production you''ll see very little reloading -- but at that stage it shouldn''t matter. David -- Q. What''s a good holiday present for the serious Rails developer? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) aka The Ruby book for Rails developers! Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.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 -~----------~----~----~----~------~----~------~--~---
Jason Vogel
2006-Dec-18 20:20 UTC
Re: MVC... Issues with Models (2nd attempt at post...previous lost?)
On Dec 18, 10:04 am, dbl...-TKXtfPMJ4Ozk1uMJSBkQmQ@public.gmane.org wrote:> Hi -- > > On Mon, 18 Dec 2006, Jason Vogel wrote: > > > I''m new to Ruby and RoR. I written a small app that has gotten my feet > > wet.Welcome! > > > I have a question about Models. Controllers, I''m good. Views and > > Partials, I''m good. > > > Okay, so Models hold data. Models have the ability to query the > > database to access and change data. Model changes are only picked up > > after server restart unlike everybody else... what? Most of my changes > > seem to be here. My controllers just say go here next and show this > > view. The real work, validation, business logic, ... all seems to be > > in the Models. One of the first things that got me interested in Ruby > > / RoR was avoiding the recompile/restart world of Java/C#. So am I > > doing something wrong? It''s almost like I''m looking for MVCL (Model - > > DataLayer ONLY, View [Presentation], Controller, and Logic).What Rails environment are you running in? In development mode you > should see everything, including models, getting reloaded. In > production you''ll see very little reloading -- but at that stage it > shouldn''t matter. > > David > > -- > Q. What''s a good holiday present for the serious Rails developer? > A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) > aka The Ruby book for Rails developers! > Q. Where can I get Ruby/Rails on-site training, consulting, coaching? > A. Ruby Power and Light, LLC (http://www.rubypal.com)Windows XP, SP2 RadRails 0.72 Development mode (technically, I not sure... ) rails (1.1.6.5618, 1.1.6) actionmailer (1.2.5.5618, 1.2.5) actionpack (1.12.5.5618, 1.12.5) actionwebservice (1.1.6.5618, 1.1.6) activerecord (1.14.4.5618, 1.14.4) activesupport (1.3.1.5618, 1.3.1) I''m not "raking" anything.... I haven''t even started down the RoR test fixture path. I wrote a little app that sends an email with a link. Open email, click link, return to 2nd controller, yea/nay, if yay, take payment, then final page, if nay, then final page. The final page does an update. Real simple on the service. I built about 20 [data] models. As I was coding, I needed method "a" on model B. Write "a", add call to "a" from Controller and run. Controller would fire new code, but "a" would not be found. Restart server, hit refresh on browser, method found. My "mild" empirical evidence that models weren''t being reloaded. David, Do you consult to Ruby/RoR resistant Enterprises :-)? I''m trying to convince management of the viability of Ruby/RoR in our JSP, Weblogic EJB world... Unfortunately, I''m not being overly successful. Thanks, Jason --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
dblack-TKXtfPMJ4Ozk1uMJSBkQmQ@public.gmane.org
2006-Dec-18 20:47 UTC
Re: MVC... Issues with Models (2nd attempt at post...previous lost?)
Hi -- On Mon, 18 Dec 2006, Jason Vogel wrote:> > > > On Dec 18, 10:04 am, dbl...-TKXtfPMJ4Ozk1uMJSBkQmQ@public.gmane.org wrote: >> Hi -- >> >> On Mon, 18 Dec 2006, Jason Vogel wrote: >> >>> I''m new to Ruby and RoR. I written a small app that has gotten my feet >>> wet.Welcome! >> >>> I have a question about Models. Controllers, I''m good. Views and >>> Partials, I''m good. >> >>> Okay, so Models hold data. Models have the ability to query the >>> database to access and change data. Model changes are only picked up >>> after server restart unlike everybody else... what? Most of my changes >>> seem to be here. My controllers just say go here next and show this >>> view. The real work, validation, business logic, ... all seems to be >>> in the Models. One of the first things that got me interested in Ruby >>> / RoR was avoiding the recompile/restart world of Java/C#. So am I >>> doing something wrong? It''s almost like I''m looking for MVCL (Model - >>> DataLayer ONLY, View [Presentation], Controller, and Logic).What Rails environment are you running in? In development mode you >> should see everything, including models, getting reloaded. In >> production you''ll see very little reloading -- but at that stage it >> shouldn''t matter. >> >> David >> >> -- >> Q. What''s a good holiday present for the serious Rails developer? >> A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) >> aka The Ruby book for Rails developers! >> Q. Where can I get Ruby/Rails on-site training, consulting, coaching? >> A. Ruby Power and Light, LLC (http://www.rubypal.com) > > Windows XP, SP2 > RadRails 0.72 > Development mode (technically, I not sure... ) > rails (1.1.6.5618, 1.1.6) > actionmailer (1.2.5.5618, 1.2.5) > actionpack (1.12.5.5618, 1.12.5) > actionwebservice (1.1.6.5618, 1.1.6) > activerecord (1.14.4.5618, 1.14.4) > activesupport (1.3.1.5618, 1.3.1) > > I''m not "raking" anything.... > I haven''t even started down the RoR test fixture path. > > I wrote a little app that sends an email with a link. Open email, > click link, return to 2nd controller, yea/nay, if yay, take payment, > then final page, if nay, then final page. The final page does an > update. > > Real simple on the service. I built about 20 [data] models. As I was > coding, I needed method "a" on model B. Write "a", add call to "a" > from Controller and run. Controller would fire new code, but "a" would > not be found. Restart server, hit refresh on browser, method found. > My "mild" empirical evidence that models weren''t being reloaded.Are these ActiveRecord::Base subclasses? I believe that if they''re not, they won''t automatically reload. You might have to put: include Reloadable in them. (I could be out of date or out of sync on this, but it''s worth a try if that''s the case.) David -- Q. What''s a good holiday present for the serious Rails developer? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) aka The Ruby book for Rails developers! Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.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 -~----------~----~----~----~------~----~------~--~---