A little help with organization!

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!

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

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. :slight_smile: But yeah, start with your models. Everything builds up from those.

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

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!