[Radiant] Re: vhost extension site scoping

2011-02-15 Thread craayzie
Oh wow. Interesting. I installed the radiant-vhost-extension by installing the gem. The add_site_columns.rb that comes with the gem looks very different than the one on github that you linked to. http://pastie.org/1566676 Seems like a bug w/ the radiant-vhost-extension gem? On Feb 15, 1:16 am, Ha

Re: [Radiant] Re: vhost extension site scoping

2011-02-15 Thread Haselwanter Edmund
On 15.02.2011, at 01:37, craayzie wrote: > Below is the migration that finally did the trick! There wasn't really > a need to have an index on the name attribute anyways since it'll > always require the site_id. The uniqueness of a field in rails is a programatic constrain in ruby, not a constr

[Radiant] Re: vhost extension site scoping

2011-02-14 Thread craayzie
Below is the migration that finally did the trick! There wasn't really a need to have an index on the name attribute anyways since it'll always require the site_id. I'm still interested in Haselwanter's note about how the config/ vhost.yml file alone should have taken care of this. Am I missing so

[Radiant] Re: vhost extension site scoping

2011-02-14 Thread craayzie
The migration to remove the unique constraint works great (below) but when I try to roll it back I get the following from sqlite: $ rake db:rollback (in /Users/username/Sites/heroku) == CleanUpSnippetConstraints1: reverting = -- remove_index(:snippets, {:name=>

[Radiant] Re: vhost extension site scoping

2011-02-14 Thread craayzie
What is it about the config/vhost.yml file that would make this unique index on the "name" attribute go away? On a related note it looks like sqlite requires that all indexed columns be unique! SQLite3::ConstraintException: indexed columns are not unique: CREATE UNIQUE INDEX "name" ON "snippets" (

Re: [Radiant] Re: vhost extension site scoping

2011-02-14 Thread Haselwanter Edmund
Snippet: name: message: 'Name wurde schon verwendet' scope: site_id in config/vhost.yml should do the trick ... On 14.02.2011, at 09:14, craayzie wrote: > So weird. I run the migration but it does nothing to db/schema.rb: > > add_index "snippets", ["name",

Re: [Radiant] Re: vhost extension site scoping

2011-02-14 Thread William Ross
On 14 Feb 2011, at 08:14, craayzie wrote: > So weird. I run the migration but it does nothing to db/schema.rb: > > add_index "snippets", ["name", "site_id"], :name => > "index_snippets_on_name_and_site_id", :unique => true > add_index "snippets", ["name"], :name => "name", :unique => true > >

[Radiant] Re: vhost extension site scoping

2011-02-14 Thread craayzie
So weird. I run the migration but it does nothing to db/schema.rb: add_index "snippets", ["name", "site_id"], :name => "index_snippets_on_name_and_site_id", :unique => true add_index "snippets", ["name"], :name => "name", :unique => true Here's the exact migration: $ cat db/migrate/004_migra

Re: [Radiant] Re: vhost extension site scoping

2011-02-13 Thread William Ross
On 14 Feb 2011, at 05:46, craayzie wrote: > 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 > > - valida

[Radiant] Re: vhost extension site scoping

2011-02-13 Thread craayzie
So I need to write a migration that will update the DB constraint to allow for unique pairs of 'name' and 'site_id' records. Only example I can find of how to do this requires creating and index: add_index :snippets, [:name, :site_id], :unique=>true Is this the best option? Or is there a way to c

[Radiant] Re: vhost extension site scoping

2011-02-13 Thread craayzie
It looks like it's a DB-level constraint that's throwing the error as opposed to something at the model level .. still figuring out how to correct this .. SQLite3::ConstraintException: column name is not unique: INSERT INTO "snippets" ("name", "updated_by_id", "created_at", "filter_id", "updated_a

[Radiant] Re: vhost extension site scoping

2011-02-13 Thread craayzie
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_