# Use a Model or Controller?

**URL:** <https://www.ruby-forum.com/t/use-a-model-or-controller/62298>\
**Category:** Rails\
**Created:** [June 2, 2006, 1:36pm UTC](https://www.ruby-forum.com/t/use-a-model-or-controller/62298 "2006-06-02T13:36:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jongretar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aca169/32.png) [@jongretar](https://www.ruby-forum.com/u/jongretar)\
**Post date:** [June 2, 2006, 1:36pm UTC](https://www.ruby-forum.com/t/use-a-model-or-controller/62298/1 "2006-06-02T13:36:11Z")

</div>

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?

–

---

<div class="post-metadata">

**Author:** ![jongretar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aca169/32.png) [@jongretar](https://www.ruby-forum.com/u/jongretar)\
**Post date:** [June 2, 2006, 2:10pm UTC](https://www.ruby-forum.com/t/use-a-model-or-controller/62298/2 "2006-06-02T14:10:26Z")

</div>

> > > > > “Jon” == Jon Gretar B. [removed\_email\_address@domain.invalid](mailto: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](mailto:removed_email_address@domain.invalid)  
[http://www.livejournal.com/users/cdybedahl/](http://www.livejournal.com/users/cdybedahl/)  
“Run little fishies! Run like the wind!” – Steve McAndrewSmith,  
A.S.R

---

<div class="post-metadata">

**Author:** ![jongretar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aca169/32.png) [@jongretar](https://www.ruby-forum.com/u/jongretar)\
**Post date:** [June 2, 2006, 2:35pm UTC](https://www.ruby-forum.com/t/use-a-model-or-controller/62298/3 "2006-06-02T14:35:06Z")

</div>

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](mailto: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](http://lists.rubyonrails.org/mailman/listinfo/rails)

–

---

<div class="post-metadata">

**Author:** ![jongretar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aca169/32.png) [@jongretar](https://www.ruby-forum.com/u/jongretar)\
**Post date:** [June 2, 2006, 7:36pm UTC](https://www.ruby-forum.com/t/use-a-model-or-controller/62298/4 "2006-06-02T19:36:11Z")

</div>

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](mailto: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](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.
