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.
Jón B. (Guest)
on 2006-06-02 15: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?

--
Calle D. (Guest)
on 2006-06-02 16:10
(Received via mailing list)
>>>>> "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
Jón B. (Guest)
on 2006-06-02 16: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 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
>


--
Alex W. (Guest)
on 2006-06-02 21: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 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.
This topic is locked and can not be replied to.