Re: [Rails-core] [Feature][ActiveRecord] Add support for specifying tables in where clauses in `unscope` method

2020-03-02 Thread Geoff Harcourt
ags > default_scope { where(deleted_at: nil) }end > > > When I call > Article.joins(:tags) > It adds the scope from belongs_to :articles (in this case unscope(where: > :deleted_at)) to the where chain and overrides the default scope of tags > (where(deleted_at: >

Re: [Rails-core] [Feature][ActiveRecord] Add support for specifying tables in where clauses in `unscope` method

2020-03-01 Thread Geoff Harcourt
Maybe the clearer way to apply it would be to allow unscoping via the merge method? I think the overall idea is worth pursuing in some fashion. We often have big queries with lots of joins on aggregate dashboards, and ordering on default scopes for joined models adds wasted expense to queries.

Re: [Rails-core] Re: [ActiveSupport] feature proposal: Create #unfreeze_time to complement #freeze_time in ActiveSupport::Testing::TimeHelpers

2018-09-02 Thread Geoff Harcourt
Would this be easier if freezing time took place in a block, and any unfrozen time followed the closure of the block? Then we wouldn't need a separate method. I think this was the recommended practice with Timecop. On Sun, Sep 2, 2018, 6:18 PM Xavier Noria wrote: > I think it makes sense. For

Re: [Rails-core] [Feature request] [ActiveRecord] Automatically create scopes for models boolean attributes

2018-01-04 Thread Geoff Harcourt
Hi Leo, A suggestion if you wanted to build this feature as a gem: the Pacecar gem used to add these scopes automatically. It's no longer maintained, but you could dig up some of the code to just get the automatic scopes for booleans. https://github.com/thoughtbot/pacecar -Geoff On Thu, Jan 4,

Re: [Rails-core] Symbol missing it's `.size` method in the Rails console

2017-10-13 Thread Geoff Harcourt
Hi Colin, What Ruby and Rails versions are you using? I'm able to use Symbol#size in a brand new Rails 5.1 application. Can you recreate the problem in a new Rails app? I suspect the #size method is missing in your application due to monkey patching Symbol in the app itself or one of its

Re: [Rails-core] Re: Feature Request: Delete associated records when model is saved

2016-02-18 Thread Geoff Harcourt
One way you could handle this would be to add a virtual attribute to your model with `attr_accessor` called `marked_for_deletion`. You could then use that flag as a temporary change to your model without deleting it, and then delete those objects in the final DB transaction after the user

Re: [Rails-core] Removing 'require_tree .' from application.js

2014-10-31 Thread Geoff Harcourt
Brian, I think require_tree often leads to problems (it’s one of the first things I remove when I’m building an app), but by loading specific JS files per page, aren’t you denying your users’ browsers the opportunity to cache the JS from other page visits? Separate per-page JavaScript files

Re: [Rails-core] config.force_ssl = true should set SSL application-wide and by default

2014-07-28 Thread Geoff Harcourt
Hi Pete, I don’t think it’s necessary to require SSL in development, so even if enabling SSL by default in production environments is a good idea (which I’m not convinced is necessary), I think requiring it in development is overkill, and makes the path to getting started on an app more

Re: [Rails-core] config.force_ssl = true should set SSL application-wide and by default

2014-07-28 Thread Geoff Harcourt
, Geoff Harcourt wrote: Hi Pete, I don’t think it’s necessary to require SSL in development, so even if enabling SSL by default in production environments is a good idea (which I’m not convinced is necessary), I think requiring it in development is overkill, and makes the path

Re: [Rails-core] Optional database connection in the initializer

2014-05-16 Thread Geoff Harcourt
Hi Pier-Olivier, Somewhat related - you might want to take a look at this approach that LevelUp uses to process payments when their system is too bogged down to process transactions in the database: http://www.confreaks.com/videos/2481-railsconf2013-zero-downtime-payment-platforms Not sure

Re: [Rails-core] how adding a version when generating a new rails project

2014-03-03 Thread Geoff Harcourt
Hi Rain, I don’t think that web applications are like software libraries in this respect. Engineering teams that are pushing software out the door are already tracking their versions with commits to their source control. SemVer is great because it helps convey things like breaking changes,

Re: [Rails-core] Being strict on differentiating between IEC prefixes and SI prefixes.

2012-10-02 Thread Geoff Harcourt
OK, pushed. I can't push my own database data up, so I'll get four questions up there for you. -Geoff -- Geoff Harcourt On Tuesday, October 2, 2012 at 4:07 PM, dburry wrote: One of the great things I like about rails is not always being tied to full backwards compatibility causing

Re: [Rails-core] Defining #blank for Array.

2012-07-09 Thread Geoff Harcourt
Michael, That array isn't blank, empty strings aren't the same as nils. I think changing that behavior would be confusing. If you don't want to count those elements, it's probably best to filter the array for non-blank strings. -Geoff -- Geoff Harcourt On Monday, July 9, 2012 at 10:15 AM

Re: [Rails-core] Scaffold Generator Woes

2012-03-08 Thread Geoff Harcourt
I would be in favor of either of these two options. I imagine extracting and gem-ifying the controllers would be a hassle, but then the default path for setting up a new view and controller action would require the user to think about what they are doing rather than just observe the magic.

Re: [Rails-core] Setting primary key value manually

2011-07-08 Thread Geoff Harcourt
I never knew what the proper practice was for this sort of thing. In scenarios where I had to ensure that a primary key was set to a number I specified, I always used a callback to modify the ID to match a facade attribute if it had been set. I'm sure that's wrong, but I could never figure out a

Re: [Rails-core] Immediate need of Mainframe Technical Lead/Developer in Miami FL

2011-05-24 Thread Geoff Harcourt
Given the number of posts to the list that don't fit the list criteria, could we move to a system where everyone's first post is screened? That might prevent both jerks like this guy and mistaken posts that should be sent to ror-talk from ending up in the discussion. -Geoff On Tue, May 24, 2011

Re: [Rails-core] Should AR set default values obtained from the schema?

2011-03-30 Thread Geoff Harcourt
I'm interested in the answer to Byrne's original question, but I think another solution here is to use '-12-31' as the infinite date. On Wed, Mar 30, 2011 at 3:25 PM, Colin Law clan...@googlemail.com wrote: On 30 March 2011 19:45, byrnejb byrn...@harte-lyne.ca wrote: First, if my