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

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!)

Hi --

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

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

Hi --