Use a Model or Controller?


#1

I am putting up a tool that connects to a subversion repository and
checks latest revision and downloads the changeset log for all the
changes made since last check and puts inside a hash for various uses
inside the code.

I am just wondering if the code that checks the subversion repo and
reads it’s data should bolong to a controller of it’s own or a model
of it’s own. Model feels the right thing to do but I am unsure how a
model reacts when it doesn’t find a table to connect to. If it runs
slower because of some inner checks. Or mabey I should generate a
completely new set of stuff like Collaboa does by creating a
ActionSubversion system(Their’s just didn’t fit my needs).

Any thoughts?


#2

“Jon” == Jon Gretar B. removed_email_address@domain.invalid writes:

Model feels the right thing to do but I am unsure how a
model reacts when it doesn’t find a table to connect to.

Doing that is one of the recipes in the “Rails Recipes” book.


Calle D. removed_email_address@domain.invalid
http://www.livejournal.com/users/cdybedahl/
“Run little fishies! Run like the wind!” – Steve McAndrewSmith,
A.S.R


#3

Doesn’t that tutorial show you how to create a databaseless app? I’m
only havingthis small part without a database.

But this is a simple case of that I didn’t see the forrest because of
all the trees. I realised that I was being stupid and simply created a
class called subversion inside a file in lib/subversion.rb. I was
focusing too much on the model infrastructure and didn’t realise that
I wasn’t using anything really that needed the model or controller
system at all.

Silly me.

On 6/2/06, Calle D. removed_email_address@domain.invalid wrote:

“Run little fishies! Run like the wind!” – Steve McAndrewSmith, A.S.R


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


#4

Jón Borgþórsson wrote:

Doesn’t that tutorial show you how to create a databaseless app? I’m
only havingthis small part without a database.

But this is a simple case of that I didn’t see the forrest because of
all the trees. I realised that I was being stupid and simply created a
class called subversion inside a file in lib/subversion.rb. I was
focusing too much on the model infrastructure and didn’t realise that
I wasn’t using anything really that needed the model or controller
system at all.

Silly me.

On 6/2/06, Calle D. removed_email_address@domain.invalid wrote:

“Run little fishies! Run like the wind!” – Steve McAndrewSmith, A.S.R


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

Models don’t need databases either. A model is simply any class that
represents a type data, and the methods to CRUD that data. you can just
create a app/models/subversion.rb with this in it:

class Subversion
def foo
#…
end
end

As long as it doesn’t inherit form Active Record it won’t try to find a
database table.