Skip to content


Subversion checkout URL

You can clone with
Download ZIP


remove uniqueness validation for app #170

wants to merge 1 commit into from

3 participants


The idea is that I'm using

class Project < ActiveRecord::Base
  has_many :rapns_apps, class_name: 'Rapns::App', dependent: :destroy

And I do want to have same name in a project scope.
Rails doesn't provide a neat way to skip validation or modifying them in an inherited class, lets say.
So maybe a good idea is to disable it. I mean, I don't see the advantages.

I'm open to discussion regarding this. Maybe this is only my opinion.



Couldn't this be served by a has_and_belongs_to relationship? In that case their would only be one instance of an "App" and projects could linked to it via a join table. And when the project is deleted, the join table entry could be removed.

This would also keep the relational integrity of notifications in the database.

Besides, having multiple apps would result in multiple connections from the rapns server, which may be an undesirable side affect of this.


@mattconnolly Anyway an app will be created in the rapn_apps table where a unique validation of name is applied, hence I don't understand how I'll help.


Sorry, this can't and shouldn't be removed. As @mattconnolly pointed out, this will result in many open connections, which you probably do not want.

I suggest creating a join table between your projects and Rapns apps. You should only ever have a single Rapns apps for each app you actually have in iTunes connect.

@ileitch ileitch closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 26, 2013
  1. @bugaiov

    remove uniq validation

    bugaiov authored
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/rapns/app.rb
2  lib/rapns/app.rb
@@ -8,7 +8,7 @@ class App < ActiveRecord::Base
has_many :notifications, :class_name => 'Rapns::Notification', :dependent => :destroy
- validates :name, :presence => true, :uniqueness => { :scope => [:type, :environment] }
+ validates :name, :presence => true
validates_numericality_of :connections, :greater_than => 0, :only_integer => true
Something went wrong with that request. Please try again.