Re: [Rails-core] [Proposal] Add additional in-project directory to load custom Rails Command within the app

2020-01-14 Thread Xavier Noria
Ah, I see now what is the point, commands are able to boot the application (eg, runner), but the lookup happens before. I would not recommend app for that, because by default any subdirectory of app is in the autoload paths and eager loaded if eager loading is enabled. Xavier PS: BTW, Zeitwerk h

Re: [Rails-core] [Proposal] Add additional in-project directory to load custom Rails Command within the app

2020-01-14 Thread Xavier Noria
Hey Prem! The lib directory is indeed in $LOAD_PATH, maybe your app does not have it for some reason? -- 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 ruby

Re: [Rails-core] Re: Why don't we redesign our website and docs rubyonrails.org like laravel.com

2019-11-01 Thread Xavier Noria
On Fri, Nov 1, 2019 at 1:52 PM Diego Toral wrote: I think Rails guides is confusing, specially for newcomers. I remember > struggling to understand it on my first days of Rails. > Can you elaborate? What was difficult to understand for you? > searchable > Patches welcome. Constraints are:

Re: [Rails-core] Re: Why don't we redesign our website and docs rubyonrails.org like laravel.com

2019-10-30 Thread Xavier Noria
On Wed, Oct 30, 2019 at 1:18 PM Agus Syahputra wrote: I don't know, I just want that rubyonrails.org need cool/modern new look. > Maybe like https://reactjs.org > The website looks modern to us, an old design would something more like this

Re: [Rails-core] Why don't we redesign our website and docs rubyonrails.org like laravel.com

2019-10-29 Thread Xavier Noria
The current design is from 2016 https://weblog.rubyonrails.org/2016/1/19/new-rails-identity/. -- 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-

Re: [Rails-core] Better translations organization

2019-09-04 Thread Xavier Noria
On Tue, Sep 3, 2019 at 4:28 AM Júlio Campos wrote: I know it sounds trivial or minor, but as a Brazilian and non-native > English speaker, I know the difficulties a person may have when trying to > learn a new technology and not have localized documentation. > That is a legit interest and someth

Re: [Rails-core] Better translations organization

2019-08-05 Thread Xavier Noria
FWIW, we've discussed this several times in the past. In the Rails code base, everything is in sync because the documentation is tighted to the software. A complete PR should ideally have code, tests, and docs. API and guides affected by the patch. A Rails release ships code and docs together. We

Re: [Rails-core] Deprecate strip_heredoc?

2019-06-08 Thread Xavier Noria
+1 too. -- 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-co

Re: [Rails-core] Is there a timeline for a new Rails 5.2 release?

2019-02-23 Thread Xavier Noria
Quick heads up! If this is blocking you, please remember that a Gemfile can point to a Git branch: gem "rails", github: "rails/rails", branch: "5-2-stable" Just in case it might help while the release is not still out. -- You received this message because you are subscribed to the Google G

Re: [Rails-core] [Feature][Generator Testing] More details in assert_file failure message

2018-09-12 Thread Xavier Noria
After thinking about it for a while, I am personally not in favor of adding this. It is not a black & white argument, but a number of things that make me lean on that resolution. I have grepped the Rails code base, which has +600 occurrences of this assertion and I believe listing the contents of

Re: [Rails-core] [Feature][Generator Testing] More details in assert_file failure message

2018-09-11 Thread Xavier Noria
Can you write some concrete examples? How would the calls look like? Which would be the assertion logic and error messages? -- 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,

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

2018-09-04 Thread Xavier Noria
On Mon, Sep 3, 2018 at 11:16 PM, 'Ryan' via Ruby on Rails: Core < rubyonrails-core@googlegroups.com> wrote: Yes I'd love to contribute a patch for this. > > I posted it as an issue in the rails repo and they directed me here. > https://github.com/rails/rails/issues/33771#issuecomment-417848091 > >

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

2018-09-02 Thread Xavier Noria
On Mon, Sep 3, 2018 at 1:28 AM, Geoff Harcourt wrote: 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. > Right. Generally you'

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

2018-09-02 Thread Xavier Noria
I think it makes sense. For the code to read well, both verbs have to match. Would you like to contribute a patch? -- 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

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

2018-09-02 Thread Xavier Noria
How would that method differ from the existing `travel_back`? If there is a difference, which would be a use case? -- 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 e

Re: [Rails-core] Re: [feature][ActiveStorage] default file

2018-08-07 Thread Xavier Noria
Hi Hamad, We believe a default is a concern closer to the view, better addressed with a view helper for example: def user_avatar(user) user.avatar || default_user_avatar end In the case of the recent trend of dummy avatars with letters in them, that default would even depend on the

Re: [Rails-core] Re: Interactive `rails new`

2018-08-04 Thread Xavier Noria
The application generator has about 25 options, I believe an interactive mode wouldn't be practical. I second Rolandas' suggestion: make your own shortcut. For example, I often want to create a vanilla application to test something quickly, --skip-bundle is the key there. I have a Bash function

Re: [Rails-core] No downtime database migrations

2018-04-19 Thread Xavier Noria
Excellent email Will, agree with all your points. -- 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 t

Re: [Rails-core] [Proposal] define String#json? to return boolean value if the object is json string

2018-04-19 Thread Xavier Noria
Definitely don't see this in the String class. If you like that API you can throw that code in the initializers of your app, though. -- 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

Re: [Rails-core] No downtime database migrations

2018-04-18 Thread Xavier Noria
Migrations without downtime are mostly a logical problem. You need to write them in a way that allows schema or data changes and two versions of the code coexisting. Sometimes that means planning a schema change in a coordinated way that perhaps requires a couple or three deploys. At the framework

Re: [Rails-core] Whitelist instead of blacklist on filter_parameters

2018-02-03 Thread Xavier Noria
On Wed, 5 Apr 2017 at 21:05, Bruno Facca wrote: > Is there any reason why config.filter_parameters uses a blacklist > approach? Why not convert it into a whitelist? > > Whitelisting tends to be safer than blacklisting as developers may forget > to blacklist parameters containing sensitive data. >

Re: [Rails-core] Contributing to Rails - a brief feedback

2017-12-17 Thread Xavier Noria
Hi Andreas, It's really cool that a university course assigns such a task, sometimes universities are totally out of touch with the world outside, so congrats on that. Thanks very much for contributing to Rails, and for sharing your experience with us. It's good to know that the contributing guid

Re: [Rails-core] Re: [Feature proposal] Migrations-like actions

2017-11-29 Thread Xavier Noria
On Thu, Nov 30, 2017 at 1:00 AM, Rory Oconnell < rory.oconn...@grandrounds.com> wrote: Hi! > > I wrote a gem which does exactly this: https://github.com/ > consultingMD/schlepper. > > It's an extraction of a basic system I had inside of our monorail. It has > been in use in production for us for a

Re: [Rails-core] [Feature Request] async option for after_commit ActiveRecord hook

2017-11-25 Thread Xavier Noria
There’s something that makes me wonder: this async option probably makes sense only in after_commit callbacks, because it seems rare that you want to run something later even if there’s a rollback. So, the generic “Callback” name in the proposed job class is really not so generic in reality. Takin

Re: [Rails-core] [Feature proposal] Migrations-like actions

2017-11-23 Thread Xavier Noria
Can you provide concrete use cases? -- Sent from Gmail Mobile -- 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.c

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

2017-10-13 Thread Xavier Noria
On Fri, Oct 13, 2017 at 5:25 PM, Colin Hart wrote: What exactly is a temporal fix? > I was joking. Sometimes you fix something, but the fix is temporary, which means it is expected to be eventually gone, should be gone better sooner than later. This may happen in many scenarios, but to put an

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

2017-10-13 Thread Xavier Noria
The typical temporal fix. -- 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

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

2017-10-13 Thread Xavier Noria
Symbol#size comes originally from Ruby. Can you see if bin/rails runner 'p :foo.size' prints 3? If it does, what happens in the console? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop recei

Re: [Rails-core] How to replace values in a block of text

2017-08-24 Thread Xavier Noria
The way to approach this depends too much on the details. Reading the file in memory and applying some simple regexp could suffice. On the other extreme you could redefine the problem by using environment variables in each call to worker_processes and having the values set externally. And there are

Re: [Rails-core] Pathname#present? for directories in Ruby 2.4

2017-08-12 Thread Xavier Noria
I think the current behavior is somewhat surprising, but not because of Rails, it is because of Ruby. The first paragraph of Pathname in the official docs says: *Pathname represents the name of a file or directory on the filesystem, but not the file itself.* Nice, since we are dealing with file

Re: [Rails-core] Using floats to represent money

2017-07-30 Thread Xavier Noria
This is not a thread about best practices representing money. We all know in general[*] you want an exact type. I have personally used arbitrary precision when enough, rationals when I have had requirements for exact division, and also integers. Rather, this is a thread about the examples in the d

Re: [Rails-core] Using floats to represent money

2017-07-29 Thread Xavier Noria
I wouldn't go as far as to say floats are *encouraged in general*, you gave an example of a questionable sample code, but also have counterexamples, for example in the type of price attributes in the AR migrations guide. Bottom line, all Rails core is aware of these gotchas, anything that could be

Re: [Rails-core] [Proposal][Feature Request] Human-readable DateTime comparisons

2016-09-30 Thread Xavier Noria
Wouldn't put this in AS, really. Albeit I understand that you find comparing dates and times confusing, the arrow of time from left to right is intuitive and matches the ordering defined in the classes quite naturally I'd say. Also, it is the ordering for these kind of data types you find in SQL a

Re: [Rails-core] How to contribute

2016-09-26 Thread Xavier Noria
Have you seen https://github.com/rails/rails-dev-box#recommended-workflow? -- 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...@go

Re: [Rails-core] [Change Request - warning, controversial] Rename "belongs_to" to what it actually is

2016-09-24 Thread Xavier Noria
On Sat, Sep 24, 2016 at 12:01 PM, Richard McSharry wrote: **Example 1 - one-to-one** > ```ruby > class Employee > has_one :salary > end > class Salary > has_key_for :employee > end > ``` > Generally speaking, the Active Record API expresses stuff at the entity level, at the model level. For

Re: [Rails-core] [Proposal] [Feature Request] Make new rails apps rubocop compliant

2016-07-16 Thread Xavier Noria
We are talking here about whether to add RuboCop by default to newly generated apps. This would then extend to a discussion about the configuration, whether to integrate with the test suite, etc. The answer, at least my answer, is that my experience says this is not something I want to add as a de

Re: [Rails-core] [Proposal] [Feature Request] Make new rails apps rubocop compliant

2016-07-11 Thread Xavier Noria
I don't use RuboCop in personal projects. In my consultant work some clients do, some don't. Those that do have different configuration files because no two Ruby teams have the same preferences (that's probably a theorem). Even more, for Rails to be consistent it should emit a config file that conf

Re: [Rails-core] [Proposal] [Feature Request] Make new rails apps rubocop compliant

2016-07-11 Thread Xavier Noria
What is a compliant skeleton app? -- 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, se

Re: [Rails-core] Option not to line up column attributes in schema.rb

2016-07-05 Thread Xavier Noria
Positive over here. People may occasionally have a look at db/schema.rb, but it's main use case is to automate stuff. Personally, I wouldn't even make it configurable in this case, we are not talking about generating a non-readable dump. Some people would even write it like that if it was their co

Re: [Rails-core] [Feature Request] Update templates of scaffold controllers

2016-06-29 Thread Xavier Noria
On Wed, Jun 29, 2016 at 4:10 PM, Andrew Emelianenko < emelianenko@gmail.com> wrote: Hello! > > Current templates of scaffold controllers is little bit outdated. Not so > flexible and not very convenient. > I have written article about refactoring Rails Controllers: > http://rubywat.com/2016/06

Re: [Rails-core] [Feature Request] Extend Date Object

2016-05-28 Thread Xavier Noria
Nowadays we are pretty conservative in general adding core extensions. But dates have a bunch of methods that conform a calculations API in which your proposal makes sense in my view. Please cc me in the PR! On Saturday, 28 May 2016, Oreoluwa Akinniranye wrote: > I'd be happy to submit a PR if

Re: [Rails-core] Increase performance

2016-05-07 Thread Xavier Noria
On Sat, May 7, 2016 at 8:19 PM, Andrey Molchanov wrote: Xavier, do you want find another similar place for changes? > We generally do not accept cosmetic changes in GitHub (unless they are part of a regular patch) because there is too much going on in the issue tracker, but if you find one or tw

Re: [Rails-core] Increase performance

2016-05-07 Thread Xavier Noria
Agree, this alternative reads better, and both options return nil. Alternatively you could use until and leave the condition positive: until node.equal? NULL yield node node = node.parent end Would you like to volunteer a PR? (Please /cc @fxn if you do.) -- You received thi

Re: [Rails-core] Increase performance

2016-05-07 Thread Xavier Noria
ol, but > > Rails has many places where this not use. A lot of code can be corrected > > according to this, but this is not done. > > And I thought, why not use it in favor of speed? > > That is what I was based when wrote this message. > > > > > > пятница, 6 мая 20

Re: [Rails-core] Increase performance

2016-05-06 Thread Xavier Noria
In general, the Rails code base wants to use Ruby idiomatically. loop is the most succinct idiom in Ruby for those kinds of loops, see for example: https://github .com/rails/rails/blob/254f57ca3668398a5fcfd4f63be5d91c4c3b1cd4/actioncable /lib/action_cable/connection/stream_event_loop.rb#L66

Re: [Rails-core] Rails Guides Idea: User can specify their OS type to filter setup instructions

2016-04-20 Thread Xavier Noria
I am not sure about scripts. In particular in Mac OS X this stuff is not standardized: Homebrew, MacPorts, Postgres.app, different Ruby version managers, etc. The assumptions you can make are few. Also, IMO not worth doing a super flexible and smart installer for this simple task. If you go the har

Re: [Rails-core] Rails Guides Idea: User can specify their OS type to filter setup instructions

2016-04-19 Thread Xavier Noria
On Tue, Apr 19, 2016 at 10:02 AM, deepak wrote: A script which the user can download and just run, will also be nice > Have you seen "The Easy Way"? http://guides.rubyonrails.org/development_dependencies_install.html#the-easy-way . -- You received this message because you are subscribed to the

Re: [Rails-core] Generate guides section headers as anchor links to themselves

2016-04-18 Thread Xavier Noria
Sounds great, would you like to work on a patch? -- 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

Re: [Rails-core] Re: metaprogramming models

2016-03-25 Thread Xavier Noria
Wait, wait, let me understand better the boundaries of this problem. Could you reply to my question above? If Foo is a metaprogrammed class, does bin/rails runner Foo work? If yes, how? Once I know the answer to this, more questions will surely follow. -- You received this message because

Re: [Rails-core] metaprogramming models

2016-03-25 Thread Xavier Noria
This departs from a fundamental convention in constant autoloading: Constant Foo is expected to be autoloaded from a file called foo.rb that lives somewhere in config.autoload_paths. In your situation there are no files for these models, so I would like to understand the details further t

Re: [Rails-core] Callbacks when autoloading constants

2016-01-24 Thread Xavier Noria
I've been thinking about this and I am not totally convinced by the configuration use case. Let me explain. A callback would technically allow that kind of class configuration idiom, but let's for a moment imagine the initializer (writing on an iPad): # config/initializers/invoice_configurati

Re: [Rails-core] Callbacks when autoloading constants

2016-01-22 Thread Xavier Noria
Let me understand the use case. Autoloading constants in initializers in general is not a good idea because the initializer only runs when the application boots. If MyClass.configure stores anything in the class object autoloaded at boot time, in development mode[*] when code changes all autoload

Re: [Rails-core] Use refinements for ActiveSupport in Rails 6?

2016-01-05 Thread Xavier Noria
On Tue, Jan 5, 2016 at 10:10 PM, Matt Jones wrote: Based on > https://github.com/ruby/ruby/blob/v2_1_0/doc/syntax/refinements.rdoc , > there does not appear to be a way for a `require`d file to trigger `using` > in the parent file: > Right now, each file in Rails core is responsible for loading

Re: [Rails-core] Pessimistic Locking

2016-01-04 Thread Xavier Noria
On Sun, Jan 3, 2016 at 1:19 PM, wrote: Unfortunately optimistic locking simply does not provide any real > guarantees once you have scaled past a single dyno > Can you elaborate? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsub

Re: [Rails-core] Use refinements for ActiveSupport in Rails 6?

2016-01-01 Thread Xavier Noria
Let me give you some context and some initial thoughts. *Context* In general, Rails makes extensive use of class reopening. For some time loading AS was all or nothing, but some years ago there was an effort to separate monkey patches in units to be able to cherry-pick them. This had a few impl

Re: [Rails-core] Use refinements for ActiveSupport in Rails 6?

2016-01-01 Thread Xavier Noria
I am a bit skeptical. The theory is that reopeining classes is anarchy, who knows what's tossed where! But I look back at +10 years of Ruby and my observation is that it is not a problem. I personally have had zero conflicts, and as a consultant I can tell you I've see quite a few projects. There

Re: [Rails-core] any and none

2015-10-13 Thread Xavier Noria
none? is currently overridden https://github.com/rails/rails/blob/256097cb570fa31ca7b8140009ebd632a430b8cb/activerecord/lib/active_record/relation.rb#L277-L280 On the other hand, none? cannot be aliased to empty? because empty? does not accept an optional block. -- You received this message be

Re: [Rails-core] ActiveRecord connection pool management

2015-10-01 Thread Xavier Noria
The only time I've seen one connection per thread being an issue was in one app that ran many processes and it started to reach the connection limit of their db server in traffic peaks. Even in that scenario, contention is also a risk if you reduce the pool. Other than the mental image that you're

Re: [Rails-core] ActiveRecord connection pool management

2015-09-30 Thread Xavier Noria
"it checks out a connection separately for each database action" Transactions are per connection, how does that approach handle them? -- 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 email

Re: [Rails-core] Question about length of ActionDispatch::Routing::Mapper class file

2015-09-19 Thread Xavier Noria
By the way, I would like to expand a bit on the Ctrl-P argument. In my mind, code has to be written according to principles that concern the code itself. How does client code look like, usage, readability, performance, good organization, maintenance, etc. I never design code to bend to anything o

Re: [Rails-core] Re: Question about length of ActionDispatch::Routing::Mapper class file

2015-09-18 Thread Xavier Noria
I'll share my point of view. In general, in programming I don't think there are many rules that apply in every single scenario. Programming is not an axiomatic system. In this case, one class/module == one file may be a good guideline sometimes (app/models), maybe not so much in other cases. It d

Re: [Rails-core] Feature suggestion: Use symbols internally with HashWithIndifferentAccess

2015-08-24 Thread Xavier Noria
On Mon, Aug 24, 2015 at 3:22 AM, Rafael Mendonça França < rafaelmfra...@gmail.com> wrote: > I think we can change but it is a backward incompatible change > In particular, it belongs to the public interface that keys are strings, #keys, #each, etc. are guaranteed to return strings. -- You receiv

Re: [Rails-core] update_columns doesn't support an empty hash

2015-05-07 Thread Xavier Noria
It makes sense to me, you get passed a hash with the attributes to update, which could be none. This is a no-op edge-case similar to append an empty list to a list, etc., and could have use cases where the hash is built programatically. The implementation generally uses iterators, which is the no

Re: [Rails-core] Rails guides translations

2015-02-23 Thread Xavier Noria
On Mon, Feb 23, 2015 at 9:30 AM, Sameer Rahmani wrote: Hi, > Does rails main repository accepts rails guides translations changes ? > No. The generation scripts have locale support, but the repo and official Rails docs do not accept translations. The main reason is that documentation has to be

Re: [Rails-core] Re: ActiveJob allow passing options to underlying library

2015-02-12 Thread Xavier Noria
On Thu, Feb 12, 2015 at 4:21 PM, Abdelkader Boudih wrote: That will require to monkey > https://github.com/rails/rails/blob/master/actionmailer/lib/action_mailer/delivery_job.rb > Yes, at this point the job for mailers is kinda private... guess it needs to be accessible somehow. -- You receive

Re: [Rails-core] Graceful handling of missing STI constants

2015-01-26 Thread Xavier Noria
You're facing one possible way to have incompatible schemas between branches. They are created by workflows external to Active Record, to me it doesn't makes sense that Active Record acts in a way it is not supposed to, to address divergences in Git branches. Divergence in Git branches is an exte

Re: [Rails-core] Rails 4.2 Foreign Key Naming

2015-01-17 Thread Xavier Noria
It's a delicate decision, because if you do automatic human readable generation like in indexes then the expectation that renames should propagate is strong. Maybe it would be also nice for the purposes of the discussion here to explain the actual gotchas we've faced doing that for indexes, so the

Re: [Rails-core] Improvements to ActiveSupport::Dependencies missing constant loading

2014-12-18 Thread Xavier Noria
On Mon, Dec 8, 2014 at 6:58 PM, Xavier Noria wrote: In general, AS::Dependencies has to be seen in a positive way: > AS::Dependencies performs a particular file lookup given a constant missing > in a certain class or module. If I make it, that contract will be > documented in a new guid

Re: [Rails-core] Improvements to ActiveSupport::Dependencies missing constant loading

2014-12-09 Thread Xavier Noria
On Mon, Dec 8, 2014 at 10:23 PM, Arron Norwell wrote: On Monday, December 8, 2014 2:35:12 PM UTC-5, Xavier Noria wrote: >> >> There's no solution, in general you cannot design AS::Dependencies with >> emulation in mind. It does not even lookup in "ancestor" pa

Re: [Rails-core] Improvements to ActiveSupport::Dependencies missing constant loading

2014-12-08 Thread Xavier Noria
Consider: Case A) module A module B class C M end end end Case B) module A::B class C M end end Case C) class A::B::C M end Case D) class X::Y::Z class A::B::C M end end Case E) A::B::C::M We have 5 examples. I

Re: [Rails-core] Improvements to ActiveSupport::Dependencies missing constant loading

2014-12-08 Thread Xavier Noria
On Mon, Dec 8, 2014 at 6:58 PM, Xavier Noria wrote: should attempt to load A::B::M? That would be really surprising and > AS::Dependencies is not able to distinguish between your example and the > constant path above. All it knows is a constant called "M" has been missing >

Re: [Rails-core] Improvements to ActiveSupport::Dependencies missing constant loading

2014-12-08 Thread Xavier Noria
In general, AS::Dependencies has to be seen in a positive way: AS::Dependencies performs a particular file lookup given a constant missing in a certain class or module. If I make it, that contract will be documented in a new guide for 4.2 I am working on. In particular, AS::Dependencies cannot be

Re: [Rails-core] Re: Rails 5 roadmap?

2014-11-26 Thread Xavier Noria
BTW, something that is in the radar is replacing accepts_nested_attributes_for with something else, maybe form objects... it is just being explored (and could end up in nothing). -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscr

Re: [Rails-core] Rails 5 roadmap?

2014-11-25 Thread Xavier Noria
On Tue, Nov 25, 2014 at 5:37 PM, Jason Fleetwood-Boldt wrote: I agree that as a framework there is no architectural mandate, and that the > idea that there is one is a (too) common misconception. It is unfortunate > that people coming to the framework do not have the perspective to know > that (a

Re: [Rails-core] Rails 5 roadmap?

2014-11-25 Thread Xavier Noria
Rails comes with a default structure that serves well a ton of apps, but does not mandate that you use that structure as is, which is a common misconception/starting point in talks, posts, etc. Those are the defaults, but of course projects can add their service objects, form objects, decorators,

Re: [Rails-core] Add ActionController::Parameters#dig to grab values out of nested params, failing gracefully

2014-11-11 Thread Xavier Noria
Adding stuff to AS core extensions has to be done carefully, the criteria is that it has to be clearly useful either for Rails internals (the main design driver of AS core extensions), or solve a common need in web development. While the quoted questions wonder about nested hashes in Ruby, that do

Re: [Rails-core] Re: ActiveRecord lock_version documentation error

2014-10-17 Thread Xavier Noria
It depends on how is the application using the lock. One use case is to load a record, do something with it, and save it. Optimistic locking here would detect a race condition where some other code changed the same record meanwhile. That's the scenario the docs refer to when talking about the loca

Re: [Rails-core] Enhancement idea for API documentation: add signatures to overloaded methods

2014-09-23 Thread Xavier Noria
Yes, those are options, but at least personally they are not my first options. Regarding tags, I don't like them for a number of reasons. In my experience tags take a disproportionate space in the source code. Also, they tend to promote one-liners next to params, returns, etc. I don't like one-lin

Re: [Rails-core] Enhancement idea for API documentation: add signatures to overloaded methods

2014-09-23 Thread Xavier Noria
Hi Claudio, We have discussed internally a little bit about it. We'd like to document return types and possibly params types to the API. Where type has to be taken as a flexible word, as in YARD conventions: classes, modules, being able to document duck typing interfaces, several options, the pos

Re: [Rails-core] Feature idea: boolean validator

2014-08-28 Thread Xavier Noria
On Thu, Aug 28, 2014 at 12:24 PM, powiii wrote: > I was thinking to implement a shorthand for validating boolean values. > > Instead of doing (which we do right now): > > validates :foo, inclusion: [true, false] > > you could do the shorter and more idiomatic: > > validates :foo, boolean:

Re: [Rails-core] Feature Request: Remove or replace *_path helpers for mailers

2014-07-30 Thread Xavier Noria
Merged. Thanks a lot Richard! <3 -- 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, sen

Re: [Rails-core] Add Object#preextend to ActiveSupport

2014-07-28 Thread Xavier Noria
I think this motivation can be summarized as: #prepend has use cases, in particular for singleton classes. I don't see this in AS. AS is defined as a fine balance: * Ruby extensions key for Rails core development. * Ruby extensions experience proves to be really really helpful/comm

Re: [Rails-core] Using slim as the default html preprocessor

2014-07-08 Thread Xavier Noria
Rails core prefers ERB because you get what you see and in this case that wins for our taste. The simplicity of ERB outweights for us the benefits other people see in those template systems. Rails ships with that default, and also allows you to switch to whatever you prefer. -- You received this

Re: [Rails-core] Feature Request: Remove or replace *_path helpers for mailers

2014-06-18 Thread Xavier Noria
I have never checked it myself (could be cargo culting), but my understanding has always been that using the BASE tag is not a good practice for portable HTML emails. See for example: http://stackoverflow.com/questions/14611225/html-base-tag-in-email I personally believe preventing *_path cal

Re: [Rails-core] Feature Request: Remove or replace *_path helpers for mailers

2014-06-18 Thread Xavier Noria
On Wed, Jun 18, 2014 at 5:45 PM, richard schneeman < richard.schnee...@gmail.com> wrote: If we go down this route, the error message should be crystal clear: > > "The method `user_path` cannot be used in a mailer as relative links in > emails do not work. Use `user_url` instead" > > Also need to m

Re: [Rails-core] Feature Request: Remove or replace *_path helpers for mailers

2014-06-18 Thread Xavier Noria
I cannot think of a valid use case for *_path in mailer views, so after thinking about it I personally would be inclined to remove them. People cannot upgrade and have their mailers crashing in production, so I think we have no option but to go through a deprecation cycle. If someone had a rare n

Re: [Rails-core] Feature Request: Remove or replace *_path helpers for mailers

2014-06-12 Thread Xavier Noria
On Thu, Jun 12, 2014 at 8:07 PM, Florian Thomas wrote: I’m in support of this as well. > As a solution i would prefer to resolve the full URL by default. Raising > an exception seems to me a bit like rails telling the programmer „I know > what you’re intending, and we both know the solution but y

Re: [Rails-core] Wrong autoload

2014-06-11 Thread Xavier Noria
I suspect it could be a combination of factors. This is something that could explain what you see: 1. Parser::Typography::Base is autoloaded 2. Parser::Typography::CharTypographer is autoloaded 3. Files change and a new request comes 4. Parser::Base is autoloaded 5. Parser::Typography::CharTyp

Re: [Rails-core] Allow dynamic STI

2014-06-11 Thread Xavier Noria
On Wed, Jun 11, 2014 at 10:29 AM, Ivailo Bardarov wrote: I see your point that Rails is following the STI pattern. > However I can't see why the column should be static in the schema and not > to use the virtual one. I will have to spare some time to work on this to > find out whats going to happ

Re: [Rails-core] Allow dynamic STI

2014-06-10 Thread Xavier Noria
On Tue, Jun 10, 2014 at 4:34 PM, Ivailo Bardarov wrote: Doesn't matter if the column comes statically or dynamically. The presence > of the "type" virtual-column in the record should be enough. > > record[inheritance_column].present? > > instead of > > record[inheritance_column].present? && colu

Re: [Rails-core] Allow dynamic STI

2014-06-10 Thread Xavier Noria
On Tue, Jun 10, 2014 at 2:53 PM, Ivailo Bardarov wrote: By virtual we mean that we don't have the 'type' column in the DB at all. > We determine it runtime via scope from the query. > > Here is an example https://gist.github.com/gudata/7ff43e3b6600408b1c1e > I don't quite see that in core. AR d

Re: [Rails-core] Allow dynamic STI

2014-06-10 Thread Xavier Noria
On Mon, Jun 9, 2014 at 3:00 PM, Ivailo Bardarov wrote: I have a case when I want to use postgres table inheritance. I want my > STI inheritance_column to be virtual. What is the reason to check > for inheritance_column in the columns_hash? > > > https://github.com/rails/rails/blob/4-2-release_not

Re: [Rails-core] Replace Sprockets with Half Pipe

2014-06-10 Thread Xavier Noria
To be exact, you need one of the supported ExecJS runtimes: https://github.com/sstephenson/execjs#execjs. -- 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

Re: [Rails-core] Feature request: Alternative separator for view helper

2014-06-07 Thread Xavier Noria
On Sat, Jun 7, 2014 at 10:14 AM, Trung Lê wrote: At the moment view helper like form or input generates HTML with naming > that use underscore. Underscored naming is not the common convention used > in frontend dev. I'd like to propose a feature to switch to dashed naming. > Sounds good to me, w

Re: [Rails-core] Rubocop linter validation

2014-04-28 Thread Xavier Noria
The Rails code code base has a lightweight style guide: http://guides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions and the generated code follows also that style. That's the one we naturally have to be consistent with, it makes no sense for us to generate code

Re: [Rails-core] Namespacing Models et al

2014-04-16 Thread Xavier Noria
On Wed, Apr 16, 2014 at 9:03 PM, Stephen Paul Weber < singpol...@singpolyma.net> wrote: On Wednesday, 16 April 2014 13:54:52 UTC-5, Xavier Noria wrote: >> >> >> Any of the options are terrible in my view, expectations are broken all >> over the place. >> >

Re: [Rails-core] Namespacing Models et al

2014-04-16 Thread Xavier Noria
On Wed, Apr 16, 2014 at 5:19 PM, Stephen Paul Weber < singpol...@singpolyma.net> wrote: Well, sure, the alternative I suggested in my first email, if doing it > automatically were too magical, was to require and/or allow users to put > the namespace on themselves. > But Rails supports namespaces

Re: [Rails-core] Namespacing Models et al

2014-04-16 Thread Xavier Noria
On Wed, Apr 16, 2014 at 4:59 PM, Stephen Paul Weber < singpol...@singpolyma.net> wrote: On Tuesday, 15 April 2014 20:17:29 UTC-5, Xavier Noria wrote: >> >> I don't think automatic namespacing is the way to go, but out of >> curiosity if user.rb has >> >

Re: [Rails-core] Namespacing Models et al

2014-04-15 Thread Xavier Noria
On Wed, Apr 16, 2014 at 2:43 AM, Stephen Paul Weber < singpol...@singpolyma.net> wrote: The case I've run into the gem *is* namespaced, but with a name that > clashed with one of my model names. Rails as currently implemented does > not control the namespace, but given how the autoloader works I

Re: [Rails-core] Namespacing Models et al

2014-04-15 Thread Xavier Noria
Rails does not control the namespace. User is defined when user.rb is evaluated. Autoloading finds user.rb if the User constant is unknown, and admin/user.rb if Admin::User is unknown, but namespace usage is up to the application. In my view, namespacing is something code meant to be shared shoul

  1   2   3   4   5   >