travis-api/lib/travis/api/v3/models
Piotr Sarnacki 81e11da856 Fix error when default branch tries to be autosaved
For some reason when branch from V2 models is being saved, it tries to
also update relationships for V3 models, at least in tests. This fails,
because default_branch association on the V3 Repository model has a
primary key set to [:id, :default_branch]. In theory we use composite
keys plugin, but it seems that it doesn't cover that case and because of
that AR fails with an error "[:id, :default_branch] is not a Symbol"
when it tries to call Model#send with primary_key as an argument.

This commit fixes the issue by overriding the send method on the
Repository model to not fail when AR does
repository.send([:id, :default_branch_name]), when it needs to fetch
a primary key.

This is hacky, but I haven't found a nicer way to get around it.
2015-11-24 15:09:58 +01:00
..
account.rb reinstate nginx, use it in development, add smare concurrency settings 2015-10-08 13:57:49 +02:00
branch.rb v3: branches - add default_branch (boolean) property 2015-10-08 18:44:40 +02:00
broadcast.rb v3: broadcasts - filter inactive broadcasts 2015-10-08 18:43:22 +02:00
build.rb v3: use cached_matrix_ids for build.jobs if only job ids are being loaded 2015-09-03 15:03:12 +02:00
commit.rb v3: allow expanding build.commit 2015-04-30 17:08:52 +02:00
email.rb no longer use models from travis-core in queries 2015-02-23 16:50:51 +01:00
job.rb v3 add _type_disabled to ovveride activerecord setting wrong class on job 2015-08-26 16:33:16 +02:00
log_part.rb no longer use models from travis-core in queries 2015-02-23 16:50:51 +01:00
log.rb no longer use models from travis-core in queries 2015-02-23 16:50:51 +01:00
membership.rb no longer use models from travis-core in queries 2015-02-23 16:50:51 +01:00
organization.rb v3: add account permissions 2015-04-29 14:14:21 +02:00
permission.rb no longer use models from travis-core in queries 2015-02-23 16:50:51 +01:00
repository.rb Fix error when default branch tries to be autosaved 2015-11-24 15:09:58 +01:00
request.rb no longer use models from travis-core in queries 2015-02-23 16:50:51 +01:00
ssl_key.rb no longer use models from travis-core in queries 2015-02-23 16:50:51 +01:00
subscription.rb v3: add subscription model 2015-04-17 12:16:11 +02:00
token.rb v3: implement enable/disable 2015-03-06 15:35:47 +01:00
user.rb v3: add subscription model 2015-04-17 12:16:11 +02:00