views:

47

answers:

1

Hi Everyone,

I am about to start working on my second ever Rails application and could do with some advice. It will probably help in my head typing this question anyway!

The application's purpose is to track and monitor marketing campaigns. That makes it sound way more professional that what it actually is though.

An example usage:

  • Add list of possible client leads to application
  • Create a new "campaign" in the application
  • Choose who on the list of possible client leads should receive the campaign
  • If and when a response is received it should then be possible to go into that client lead's profile and mark as "Positive Response" or "Negative Response" etc..
  • Once the campaign is completed it should be marked as complete, I should be able to view in a campaigns profile who was a recipient of it and likewise if I view a client lead's profile I should be able to see which campaigns were sent to them and when.

That's the general idea of the application. I have made the framework and pushed it to GitHub:

http://github.com/dannyweb/Marketing-Manager

I am trying to get an idea of what models I would need, what sort of associations they should have etc.

I am unsure whether to use something such as acts_as_taggable and give each client lead a tag which relates to a campaign name?

If anyone can offer their thoughts or ideas on how this should be structured it would be greatly appreciated.

As it's my second Rails application - I am still very much a beginner, so please be kind! The application will remain open source on GitHub if anyone is reading this and would like to use the application.

Thanks,

Danny

+2  A: 

I think you shouldn't turn to plugins (like acts_as_taggable) just yet. I'm going to give you some pointers but not much, because figuring out what works or doesn't is exactly what will help you learn more about rails.

So, you will have a 'Client' model and a 'Campaign' model. They have an N->N relationship (A campaign can involve multiple clients, and a client can be a part of multiple campaigns).

Therefore, you'll also need another table, which will have the 'client_id' and the 'campaign_id'. You also want to store on this table wether the client replied to it, so it'll need a 'replied' boolean flag on it as well. If you call this table 'campaign_messages', then client will need to link to campaigns using 'has_many :campaigns, :through => :campaign_messages'.

With these in place, you'll be able to list all clients on a campaign or all campaigns of a client easily. You'll also probably not need REST resource for the campaign_messages, only clients and campaigns.

That's all the detail I'm going to provide you. I think it'd be better if you just followed your approach now and asked how it could be improved instead.

Cheers and good luck

Marcos Toledo
Thanks Marcos, much appreciated.I'll continue on taking the above into account - let's see how I get on. Thanks!
dannymcc