travis-api/lib/travis/api/v3
Piotr Sarnacki 1cc6a2623d 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 13:46:15 +01:00
..
access_control v3: in access control object, avoid firing multiple permissions queries (even though they are cache hits) 2015-11-20 16:24:26 +01:00
extensions v3: reduce object allocations from polyorphic relations patch 2015-05-11 17:14:24 +02:00
models Fix error when default branch tries to be autosaved 2015-11-24 13:46:15 +01:00
paginator v3: add pagination 2015-08-21 17:04:12 +02:00
permissions initial work to add build and job cancellation incl updating existing specs 2015-09-25 16:04:47 +02:00
queries allow setting sidekiq worker class 2015-10-30 16:29:09 +01:00
renderer v3: add developer program feature flag 2015-10-21 16:57:21 +02:00
routes v3: more info in the service index 2015-08-25 19:41:04 +02:00
services V3 add user/:id/sync endpoint 2015-10-29 17:57:30 +01:00
access_control.rb start working on API v3 2015-01-13 15:22:20 +01:00
constant_resolver.rb v3: add attributes to service index 2015-03-09 19:48:52 +01:00
error.rb v3: find repos for current user (used for dashboard) 2015-01-23 19:27:01 +01:00
features.rb v3: add subscription model 2015-04-17 12:16:11 +02:00
github.rb v3: more info in the service index 2015-08-25 19:41:04 +02:00
model.rb v3: fix Model#=== 2015-04-22 16:24:26 +02:00
models.rb v3: use branches table for default_branch, eager load on /repos endpoint to avoid N+1 queries 2015-02-23 22:54:28 +01:00
opt_in.rb first actually working version of v3 2015-01-20 16:33:11 +01:00
paginator.rb v3: add pagination 2015-08-21 17:04:12 +02:00
permissions.rb v3: introduce permission objects 2015-04-29 10:50:34 +02:00
queries.rb v3: introduce query objects for DB interaction 2015-01-27 13:57:51 +01:00
query.rb allow setting sidekiq worker class 2015-10-30 16:29:09 +01:00
renderer.rb v3 add _type_disabled to ovveride activerecord setting wrong class on job 2015-08-26 16:33:16 +02:00
result.rb v3: add @warnings 2015-08-21 19:50:37 +02:00
router.rb remove debug output 2015-10-28 13:20:18 +01:00
routes.rb V3 add user/:id/sync endpoint 2015-10-29 17:57:30 +01:00
service_index.rb v3: expose default sorting mode in service index 2015-10-28 16:13:34 +01:00
service.rb v3: add ability to sort branches 2015-10-06 17:35:56 +02:00
services.rb put jobs service back in 2015-09-11 11:10:36 +02:00