active_record_shards icon indicating copy to clipboard operation
active_record_shards copied to clipboard

Remove call to on_shard directly on ActiveRecord::Base

Open pschambacher opened this issue 7 years ago • 5 comments

I think this call was missed when moving the on_shard method out of AR::Base and making the default not_sharded.

/cc @bquorning @grosser @jacobat

pschambacher avatar Dec 11 '17 21:12 pschambacher

I agree, tests would be great. How do we test rake tasks?

jacobat avatar Dec 11 '17 21:12 jacobat

require the file and then .execute the task alternatively extract logic into static methods

On Mon, Dec 11, 2017 at 1:47 PM, Jacob Atzen [email protected] wrote:

I agree, tests would be great. How do we test rake tasks?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zendesk/active_record_shards/pull/167#issuecomment-350869144, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAsZwvjcXM8m9gwWZowSe68HxqeR3mZks5s_aMPgaJpZM4Q-DLu .

grosser avatar Dec 11 '17 21:12 grosser

What I tend to do is write what I need in lib and simply make a method call in the rake task. Basically avoiding any logic in the rakefile.

pschambacher avatar Dec 11 '17 21:12 pschambacher

It's more complicated than anticipated since environment is not a defined task...

pschambacher avatar Dec 12 '17 18:12 pschambacher

Basically avoiding any logic in the rakefile.

💯

jacobat avatar Dec 13 '17 10:12 jacobat