resolve/refinerycms — pull request #1486 by phiggins (2012-03-22 02:13:52+00:00)
Title: Custom slugs should be unique

This adds a uniqueness validation on Refinery::Page's custom_slug column using a forked version of globalize3 (svenfuchs/globalize3#121) because the released version does not support uniqueness validations on translated columns. The provided spec passes, but another spec fails:

```
[19:03:27 refinerycms (custom_slugs_should_be_unique *)]$ rake spec
/Users/pete/.rvm/rubies/ruby-1.9.3-p125/bin/ruby -S rspec ./authentication/spec ./core/spec ./dashboard/spec ./images/spec ./pages/spec ./resources/spec
Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}
....................................................................................................................................................................................................................................................................................................................................................................F................................

Failures:

1) page frontend custom_slug set should make and use a new friendly_id
Failure/Error: page_cs.save
ActiveRecord::StatementInvalid:
SQLite3::SQLException: no such column: refinery_page_translations.refinery::page_id: SELECT 1 FROM "refinery_page_translations" WHERE ("refinery_page_translations"."custom_slug" = 'about-custom' AND "refinery_page_translations"."locale" = 'en' AND "refinery_page_translations"."refinery::page_id" != 3) LIMIT 1
# ./pages/spec/requests/refinery/pages_spec.rb:163:in `block (4 levels) in '

Finished in 53.76 seconds
389 examples, 1 failure

Failed examples:

rspec ./pages/spec/requests/refinery/pages_spec.rb:166 # page frontend custom_slug set should make and use a new friendly_id
rake aborted!
/Users/pete/.rvm/rubies/ruby-1.9.3-p125/bin/ruby -S rspec ./authentication/spec ./core/spec ./dashboard/spec ./images/spec ./pages/spec ./resources/spec failed

Tasks: TOP => spec
(See full trace by running task with --trace)
```

I opened this pull request to attempt to provide some feedback and help get the issues sorted out on both sides.

/cc @shioyama