Forum: Ruby on Rails A little help with organization!

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.
3bc555eb01bf510bf098c07b7db543cc?d=identicon&s=25 CPerry (Guest)
on 2007-06-04 15:42
(Received via mailing list)
Hey all, first let me say that this list has been very valuable for me
in learning the basics of Rails, so I appreciate this list very much!

I have been doing a great amount of reading, studying, and learning,
and now I am ready to start building my first Rails app. However, I
need a little help with how to actually proceed with the build
process. I would like to know how you guys plan your apps, and what
order you build pieces in.

I am building an app that will allow users to post pets that they need
to find a great home for. Here are the basic requirements that this
app will need:

1. User will create an account that will include all of their personal
information. (Name, email, Login/Pass, etc.)
2. User will fill out a form for their pet to post it on the site.
(Type of pet, sex, breed, etc., etc.)
3. User will upload an image of the pet if they have it. (Otherwise
default to a generic image)
4. User will be able to edit, delete their posts once the pet has a
new home. Users will also be able to edit their account to keep their
information up to date.
5. Visitors will be able to search pets by type, breed, etc.

My questions is, what should the general work flow be for this
project? How would you tackle it as far as which pieces to build
first, streamlining the development process, etc.? Since this will be
my first actual build, I want to be sure that I develop this project
in the correct manner, based on the MVC flow of things.

I appreciate any guidance you all can give me for tackling my first
Rails app.!! Thanks!
82a578052d304559f15180bdf56555d2?d=identicon&s=25 Tarscher (Guest)
on 2007-06-04 16:26
(Received via mailing list)
I don't think there is one good workflow to start building your app
but I really prefer the agile way. Meaing you have something working
very fast.

I would first define the models and the relationship between them
(start with User and Pet) . Implement the user controller/functions
afterwards (login/loguit/basic user editing).

Have something working very quickly and start adding things to it. I
often see the user functions (login, logout) as the basic and continue
on top of that.

Regards,
Stijn
Ff168162d53e22788d576582b3527e97?d=identicon&s=25 Bill Kocik (Guest)
on 2007-06-04 16:29
(Received via mailing list)
On Jun 4, 9:42 am, CPerry <c...@coryperry.com> wrote:

> I
> need a little help with how to actually proceed with the build
> process. I would like to know how you guys plan your apps, and what
> order you build pieces in.

I imagine I'm pretty typical in this regard - I start by defining my
models and migrations. Those are, after all, the core pieces of a
typical Rails app, and will dictate your controllers and actions.

> 1. User will create an account that will include all of their personal
> information. (Name, email, Login/Pass, etc.)

That's a model (which probably "has_many :pets")

> 2. User will fill out a form for their pet to post it on the site.
> (Type of pet, sex, breed, etc., etc.)

There's another model. Perhaps a collection of models (Pet, Cat < Pet,
Dog < Pet, Snake < Pet, etc.), probably using single-table inheritance
(see the Agile book). That'll be a design choice for you to make.
(also likely "belongs_to :user")

> 3. User will upload an image of the pet if they have it. (Otherwise
> default to a generic image)

See the attachment_fu plugin to make your life easier here.

> 4. User will be able to edit, delete their posts once the pet has a
> new home. Users will also be able to edit their account to keep their
> information up to date.

Kind of built-in. You just need to provide forms and controller
actions for this (which Rails will happily scaffold for you to give
you something to build upon).

> 5. Visitors will be able to search pets by type, breed, etc.

This sounds like a custom controller that takes search parameters from
the user and queries the "pets" table. Or, you could make search an
action of the pets controller. It's really up to you.

> My questions is, what should the general work flow be for this
> project? How would you tackle it as far as which pieces to build
> first, streamlining the development process, etc.?

Maybe I gave you more information than you asked for. :) But yeah,
start with your models. Everything builds up from those.
83ca41657a99b65d99889abe712ba5e2?d=identicon&s=25 Jason Roelofs (Guest)
on 2007-06-04 16:30
(Received via mailing list)
To add to what Tarscher said, I've found that it's better to start as
high a
level as possible, in this case the UI itself. Then you work down the
hierarchy, writing integration tests, writing controller tests, writing
controller code, writing model tests, writing model code.

That way you have exactly what you need, no more, no less.

Jason
3bc555eb01bf510bf098c07b7db543cc?d=identicon&s=25 CPerry (Guest)
on 2007-06-04 17:05
(Received via mailing list)
Thanks for the replies from all of you. You have certainly guided me
in the direction that I needed. It sounds like I now need to get a
good handle on models and relationships. I would certainly like to
hear from others though if you guys want to chime in any other info.
Thanks!
This topic is locked and can not be replied to.