So this appears to be simple issue of the Snippets model validation not being updated. I know the proper way to do this is to create an ActiveRecord migration but just to see it work I hand-edited vendor/ radiant/app/models/snippet.rb
- validates_uniqueness_of :name, :scope + validates_uniqueness_of :name, :scope => :site_id I then ran 'rake db:migrate' but nothing changed? Did I miss a step? On Feb 13, 8:41 pm, craayzie <[email protected]> wrote: > I now have two sites running on the same Radiant instance using the > vhost extension. When I try to add a snippet to the 2nd site, > ActiveRecord complains that I'm violating the unique constraint on the > snippet name. I thought the "apply_site_scoping" rake task of the > vhost extension would have limited any unique constraints to be within > the context of the site? > > What's the proper way to have ActiveRecord apply this constraint only > within the site "namespace"? > > 2011-02-13T20:25:45-08:00 app[web.1]: ActiveRecord::StatementInvalid > (PGError: ERROR: duplicate key value violates unique constraint > "name" > 2011-02-13T20:25:45-08:00 app[web.1]: : INSERT INTO > "snippets" ("name", "updated_by_id", "created_at", "filter_id", > "updated_at", "created_by_id", "lock_version", "content", "site_id") > VALUES('google_analytics', NULL, '2011-02-14 04:25:45.024735', '', > '2011-02-14 04:25:45.024735', 1, 0, 'fake-content', 2) RETURNING "id"):
