Hello, I'm new here, and new to Ruby and Rails. I've worked with Ruby some in the past, so I have a bit of prior knowledge, but Rails is all new to me. I just bought Simply Rails 2. My friends and I were trying to think of an application I could build. So we thought of a application that would pick where we eat every day. (Kind of a joke, but we'll use it.) So we started planning it out and how it would work and such. So our database will need 3 columns: Name, weight, and special. Let me explain these:

Name - Name of the restaurant

Weight - How much we like that restaurant, and thus we want the program to be more likely to pick restaurants weighted higher

Special - This is for if a restaurant has a special, or a deal on a certain day. This took me a bit of thinking, but here is how I decided to use this: Because it is possible for a restaurant to have more than one special per week, I needed something more than just mon, tue, wed, ect. So I've assigned each day a number:

Mon - 1

Tue - 2

Wed - 4

Thurs - 8

Fri - 16

Here is how this will work: If a restaurant has a special on Monday, the column will get a 1. If it has a special on Tues, it will get a 2. If it has a special on Mon and Tues, it will get a 3 (it will get a 3 because that is Monday and Tuesday added -> 1 + 2 = 3).

So the app needs to look at the day, and look at the special column, and see if the number means that it has a special today. If it does, then it needs to multiply the weight by 10.

Now the part that I can't figure out, is how to weight the restaurants. My friend suggested that I use an array, and have the restaurant put in the array the number of times that it is weighted (So if it had a weight of 5, it would be put in the array 5 times). This would work, but I figured that there must be a better way. This way just seems kinda hacky. But maybe I'm wrong and it is the exact way a expert programmer would do it.

All that being said, here's what I've done so far:

Set up the database using SQLite, by creating a model, and then migrating it. Then I created a Restaurant controller which will have an index method that will basically do everything I've said above. It will have a new method that will let us add restaurants to the list. And here we need some check boxes for the days of the weeks, which the program can use to figure out the special number.

If you've read all of this, I greatly thank you, and I look forward to hearing your suggestions.