Forum: Ruby on Rails Use a Model or Controller?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
30ee518e6fdc5b07e060775b5a542bdb?d=identicon&s=25 Jón Borgþórsson (jongretar)
on 2006-06-02 13:36
(Received via mailing list)
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?

--
9d7d8ef2179661d6b30e180fa588cd45?d=identicon&s=25 Calle Dybedahl (Guest)
on 2006-06-02 14:10
(Received via mailing list)
>>>>> "Jon" == Jon Gretar Borgthorsson <jon.borgthorsson@gmail.com> 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 Dybedahl <calle@cyberpomo.com>
		 http://www.livejournal.com/users/cdybedahl/
   "Run little fishies!  Run like the wind!" -- Steve McAndrewSmith,
A.S.R
30ee518e6fdc5b07e060775b5a542bdb?d=identicon&s=25 Jón Borgþórsson (jongretar)
on 2006-06-02 14:35
(Received via mailing list)
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 Dybedahl <rails@cyberpomo.com> wrote:
>    "Run little fishies!  Run like the wind!" -- Steve McAndrewSmith, A.S.R
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
D0cd6b10e01bacb976b3b815a9c660bc?d=identicon&s=25 Alex Wayne (Guest)
on 2006-06-02 19:36
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 Dybedahl <rails@cyberpomo.com> wrote:
>>    "Run little fishies!  Run like the wind!" -- Steve McAndrewSmith, A.S.R
>> _______________________________________________
>> Rails mailing list
>> Rails@lists.rubyonrails.org
>> 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.
This topic is locked and can not be replied to.