validation

My understanding is that for a rails (or active record) app, the data
validation occurs in the model? While my first inclination is to prevent
the rss feed from showing up twice in the "subscriptions" model, this is
the wrong approach, in that two users might subscribe to the same feed.
Actually, that would be a many-to-many relationship, so a join table is
required. A reasonable approach? And then, ensure that the list of
subscriptions is unique?

thufir@ARRAKIS:~/projects/rss2mysql$
thufir@ARRAKIS:~/projects/rss2mysql$ ruby query.rb
"--------begin subscriber-----------"
#<Subscriber id: 1, subscriber: "alpha">
#<Subscription id: 1, subscriber_id: 1, subscription: "http://
groups.google.ca/group/ruby-talk-google/feed...">
#<Subscriber id: 1, subscriber: "alpha">
#<Subscription id: 4, subscriber_id: 1, subscription: "http://
groups.google.ca/group/rubyonrails-talk/feed...">
"----------end subscriber---------------"
"--------begin subscriber-----------"
#<Subscriber id: 2, subscriber: "beta">
#<Subscription id: 2, subscriber_id: 2, subscription: "http://
www.slashdot.org/index.rss">
#<Subscriber id: 2, subscriber: "beta">
#<Subscription id: 3, subscriber_id: 2, subscription: "http://
groups.google.ca/group/rubyonrails-talk/feed...">
"----------end subscriber---------------"
thufir@ARRAKIS:~/projects/rss2mysql$
thufir@ARRAKIS:~/projects/rss2mysql$ mysql -u ruby -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 87
Server version: 5.1.37-1ubuntu5 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the current input
statement.

use rss2mysql;

Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

Thufir wrote:

My understanding is that for a rails (or active record) app, the data
validation occurs in the model?

Data validation occurs (or should occur) in the database in most cases
(BTW, this works better in PostgreSQL than MySQL). The ActiveRecord
validations are only a backup.

While my first inclination is to
prevent
the rss feed from showing up twice in the "subscriptions" model, this is
the wrong approach, in that two users might subscribe to the same feed.
Actually, that would be a many-to-many relationship, so a join table is
required. A reasonable approach? And then, ensure that the list of
subscriptions is unique?

I don't know. What's your business logic here? You neglected to
explain it.

Best,