It may also be more appropriate to use Postgres's built-in ability to set
per-user connection defaults rather than relying on Rails to set them up
after connecting.

On Mon, Jun 6, 2016 at 11:34 AM, Jason Fleetwood-Boldt <t...@datatravels.com
> wrote:

> Ah yes I see what you mean. I think you're right, the after_fork only runs
> when the Unicorn/Puma process is forked, not AR connection re-established.
>
> In that case, a hook inside of ActiveRecord::Base does indeed seem more
> appropriate.
>
>
>
>
> > On Jun 6, 2016, at 11:23 AM, Greg Navis <cont...@gregnavis.com> wrote:
> >
> > Jason, thanks for your reply. I think your approach has the same problem
> as initializers - the code won't be executed for connections reestablished
> during the app's lifetime. Please correct me if I'm wrong here.
> > --
> > Greg Navis
> > I help tech companies to scale Heroku-hosted Rails apps.
> > Free, biweekly scalability newsletter for SaaS CEOs
> >
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Ruby on Rails: Core" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to rubyonrails-core+unsubscr...@googlegroups.com.
> > To post to this group, send email to rubyonrails-core@googlegroups.com.
> > Visit this group at https://groups.google.com/group/rubyonrails-core.
> > For more options, visit https://groups.google.com/d/optout.
>
> ----
>
> Jason Fleetwood-Boldt
> t...@datatravels.com
> http://www.jasonfleetwoodboldt.com/writing
>
> If you'd like to reply by encrypted email you can find my public key on
> jasonfleetwoodboldt.com (more about setting GPG: https://gpgtools.org)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-core+unsubscr...@googlegroups.com.
> To post to this group, send email to rubyonrails-core@googlegroups.com.
> Visit this group at https://groups.google.com/group/rubyonrails-core.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to