Re: [Rails-core] Deprecate strip_heredoc?

2019-06-09 Thread Godfrey Chan
, 2019 at 7:22 PM Godfrey Chan wrote: > +1 to what Matthew said > > If we are switching the use case of the method to stripping indentation, I > wonder if we should just call it `outdent`. > > By default it could auto detect the indentation like it does now, but > there were a

Re: [Rails-core] Deprecate strip_heredoc?

2019-06-09 Thread Godfrey Chan
+1 to what Matthew said If we are switching the use case of the method to stripping indentation, I wonder if we should just call it `outdent`. By default it could auto detect the indentation like it does now, but there were a couple of times I was processing strings with known indentation that I

Re: [Rails-core] Re: RFC: Rails-API: Proposed better interface for registering serializers with the controller

2015-06-24 Thread Godfrey Chan
I had a related user case at some point that led me down to path of the passive_model_serializers experiment. Basically, the observation is that serializers:models is a N:1 relationship, not 1:1. So imo asking the model what its serializer

Re: [Rails-core] Versions affected by CVE-2015-3226

2015-06-19 Thread Godfrey Chan
You are correct! Rails < 4.1 is not affected. Sorry for the confusion! Godfrey (Rails core team) — Sent from Mailbox On Fri, Jun 19, 2015 at 7:30 PM, Nemanja Čorlija wrote: > Rails 3.2.22 did not receive a fix for CVE-2015-3226 >

Re: [Rails-core] Support Different Column Names in has_secure_password

2015-02-05 Thread Godfrey Chan
On Thursday, Feb 5, 2015 at 3:40 PM, t...@t0dd.io , wrote: I'd like to gauge interest in adding support for different column names for ActiveModel::SecurePassword. Currently, has_secure_password assumes that the column name for the attribute you want to encrypt is simply "password." Obviously,

Re: [Rails-core] Was 4.0.3 taged/released correctly or did something go wrong?

2014-02-19 Thread Godfrey Chan
4.0.3 is a security update. To make it easy to apply security fixes, we try to make these security updates as minimal as possible.  The other bug fixes originally scheduled for 4.0.3 are pushed to 4.0.4.  Godfrey — Sent from Mailbox for iPhone On Wed, Feb 19, 2014 at 3:45 AM, Adrien Siami

Re: [Rails-core] Why isn't Postgresql the Default Database?

2014-02-09 Thread Godfrey Chan
Rails switched from MySQL to SQLite to improve the on boarding experience. The original announcement has more details.  http://weblog.rubyonrails.org/2007/12/17/rails-2-0-2-some-new-defaults-and-a-few-fixes/ — Sent from Mailbox for iPhone On Sun, Feb 9, 2014 at 10:37 AM, Rafael Mendonça França

Re: [Rails-core] Re: Remove :js responder

2013-11-29 Thread Godfrey Chan
henticate "private" JSONP/JS endpoints > IMO, it should be fixed somewhere in code, not in documentation. People > don't read it periodically. > Not using cookies for JS responses breaks the idea of templating. For API > people should use JSON(P). Why JS? > > >

Re: [Rails-core] Re: Remove :js responder

2013-11-29 Thread Godfrey Chan
On Fri, Nov 29, 2013 at 7:27 AM, Egor Homakov wrote: > @dhh as i mentioned above for GET request this will always be a security > breach. > GET requests using Cookies for authentication. That returns non-public data. -- You received this message because you are subscribed to the Google Groups

Re: [Rails-core] Re: Remove :js responder

2013-11-29 Thread Godfrey Chan
Right, I agree that if used incorrectly this be a vector for CSRF attacks. But like you said, this is also a problem for JSONP, which is by far way more popular. So unless we also remove JSONP there problem you are complaining is still there, no? Maybe we should improve the documentation to point

Re: [Rails-core] Remove :js responder

2013-11-28 Thread Godfrey Chan
I am not against removing this (I personally don't have use for this anymore), but the reason behind the removal this seems unclear to me. If it's just "let's remove this because no one uses this anymore" (and if that's true), or "Rails want to discourage this type of architecture in favour of mov

Re: [Rails-core] Query caching in active record

2013-10-09 Thread Godfrey Chan
I thought query caching is per-request?  (thread?) Is there a scenario where sharing the query cache is appropriate? Godfrey — Sent from Mailbox for iPhone On Wed, Oct 9, 2013 at 9:32 PM, Stewart wrote: > Hi, > It seems that Active record query caching is all done in memory. This is > fin

Re: [Rails-core] Drop `jquery-ujs` dependency

2013-08-08 Thread Godfrey Chan
I think you probably underestimated the complexity involved in maintaining JavaScript libraries that targets multiple browsers :) "I did X in 5 lines of pure JavaScript that worked great for my app in the 2 browsers that I care about" is not the same thing as "X is easy in JavaScript, who needs li

Re: [Rails-core] Re: decoupled/modular testing and rails

2013-08-08 Thread Godfrey Chan
What Steve said, plus I don't think shipping this as a Gem would work as nicely as you imagine – for one thing, if you are doing something like this you'd likely have to target and test for multiple version of Rails/AR/... using a gem for this does not allow you to switch easily between versions.

Re: [Rails-core] rails devise functionality with orientdb database

2013-08-07 Thread Godfrey Chan
This mailing list is reserved for the discussion of development of core Rails features. For support questions please consider using Stackoverflow, Quora, #RubyOnRails on IRC or the rubyonrails-talk mailing list. Please do not reply to this thread and reply to the OP directly if you would like

Re: [Rails-core] Re: [Rails] Required :Embed voice recorder on a webpage for a rural innovation project

2013-08-01 Thread Godfrey Chan
This mailing list for the discussion of development of core Rails features. For support please consider using Stackoverflow, Quora, #RubyOnRails on IRC or the rubyonrails-talk mailing list. Please stop replying to this thread and reply to the OP directly if you would like to continue the discu

Re: [Rails-core] ActiveSupport::JSON::Encoding SystemStackError: stack level too deep

2013-07-27 Thread Godfrey Chan
I'm working on a PR in the same area (AS::JSON::Encoding). I allocated some time to work on this on Tuesday at our local ruby hack night. If your still need help by then we can probably look into this together. Chat on IRC? — Sent from Mailbox for iPhone On Sat, Jul 27, 2013 at 2:23 PM, Sergio C

Re: [Rails-core] Re: Generic asset definitions and management

2013-07-27 Thread Godfrey Chan
I don't think this is a Rails problem. The problem is that the "Bundler/Rubygems for (client-side) JavaScript libraries" does not exists yet, and I think having "Rails people" "lead the way" here would be counterproductive. Bower is making some good progress, and is a promising candidate, but it i

[Rails-core] Re: Reported action time doesn't match Chrome's "waiting" reported time

2013-07-22 Thread Godfrey Chan
Hi Rodrigo, For the future, I suspect this question is more appropriate on Stackoverflow/Quora than rubyonrails-core, but here is my quick take on this: On Monday, July 22, 2013 7:40:56 AM UTC-7, Rodrigo Rosenfeld Rosas wrote: > > I'm tuning the performance of some request in my application and

Re: [Rails-core] Re: [Routing] Array constraints for path segments

2013-07-11 Thread Godfrey Chan
I think the biggest problem for this is that it might encourage abuse of the feature. While this might make sense for a few items (like small, medium and large photo; or all, pending and completed todo items - in these case I think it makes more sense to define them as routes than handling them

Re: [Rails-core] false.present? is false. Is it desired behaviour?

2013-05-30 Thread Godfrey Chan
Regardless of the merit (I don't have a strong opinion on what is "correct" here), it's 100% too big of a breaking change and it's gonna break a lot of people's app in some subtle but potentially very dangerous ways. -100 for me  — Sent from Mailbox for iPhone On Thu, May 30, 2013 at 2:33 PM,

[Rails-core] Moving plural detection and --force-plural option to models generator

2013-05-03 Thread Godfrey Chan
Hi all, I talked to Aaron briefly about this at RailsConf, but I just wanted to bring this up here before I start working on it in case anyone objects. I will be looking into moving the "Plural version of the model detected, using singularized version. Override with --force-plural." warning and t

[Rails-core] Re: ActiveRecord Warnings and Live Stream Failure/Error on Dev Box

2013-04-25 Thread Godfrey Chan
On Thursday, 25 April 2013 15:22:09 UTC-7, Godfrey Chan wrote: > > +1, just bumped into the same problem. > > On Tuesday, 23 April 2013 20:40:27 UTC-7, Chad Moone wrote: >> >> I've recently been trying to contribute, and I've set up the dev >> box<h

[Rails-core] Re: ActiveRecord Warnings and Live Stream Failure/Error on Dev Box

2013-04-25 Thread Godfrey Chan
+1, just bumped into the same problem. On Tuesday, 23 April 2013 20:40:27 UTC-7, Chad Moone wrote: > > I've recently been trying to contribute, and I've set up the dev > boxenvironment per these > instructions

Re: [Rails-core] Rails' scaffold controller generator - should it test json format also?

2013-04-15 Thread Godfrey Chan
TL;DR... If someone is going to add this, I'm definitely a +1 (fwiw) I completely agree with Steve that the generated tests are just examples, but from there I drew the opposite conclusion (unless I misunderstood what you said). I might be biased (I wrote json_expressions

Re: [Rails-core] Re: [SEC] [ANN] Rails 3.2.13, 3.1.12, and 2.3.18 have been released!

2013-03-30 Thread Godfrey Chan
https://groups.google.com/forum/m/#!msg/rubyonrails-security/G4TTUDDYbNA/wamRH2Tijz0J— Sent from Mailbox for iPhone On Sat, Mar 30, 2013 at 12:06 PM, Borna Novak wrote: > Hi all, > not criticizing :) just curious, what's the rational for publishing > critical security issue hot fixes on 2.3 and

Re: [Rails-core] Why "head" won't send an empty response?

2013-03-26 Thread Godfrey Chan
u can email me directly, although I think my last two responses already covered pretty much everything I know about this change. Godfrey On Tue, Mar 26, 2013 at 1:43 PM, Rodrigo Rosenfeld Rosas wrote: > Em 26-03-2013 17:23, Rodrigo Rosenfeld Rosas escreveu: > > Em 26-03-2

Re: [Rails-core] Why "head" won't send an empty response?

2013-03-26 Thread Godfrey Chan
Just a wild guess - have you noticed the change in Rails 4 where assets in the vendor directory are no longer digested? For example, if you have /vendor/assets/fonts/font-awesome.ttf or /vendor/assets/images/glyphicons.png, and if you used to reference them in SASS with font-url(font-awesome.t

Re: [Rails-core] IEC60027-2

2013-03-24 Thread Godfrey Chan
See Github #7819, #7829, #7830, #7835 and friends. Summary: because this is number_to_human_size not  number_to_computer_scientist_size. Human here refers to your users/customers. If they happen to be computer scientists you should roll your own (and maybe make it a gem and open source it). — S

Re: [Rails-core] Use = instead of BETWEEN when a date range's begin and end are the same

2013-03-17 Thread Godfrey Chan
Since this is a perf PR, I think it'd be nice to see some benchmarks to be absolutely sure. -- 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-co

Re: [Rails-core] Correct Use or Naming of Migrations

2013-02-18 Thread Godfrey Chan
On Mon, Feb 18, 2013 at 4:46 AM, Godfrey Chan wrote: > (as in - running db:seed multiple times on incremental *rollbacks* would > not create duplicate data, etc. Use find_or_create_by and friends to help) Of course I meant to type "deploys". My apologies for the spam. -- Y

Re: [Rails-core] Correct Use or Naming of Migrations

2013-02-18 Thread Godfrey Chan
ould do the seeding there, but you'd still want to keep your seed.rb up to date. On Mon, Feb 18, 2013 at 4:27 AM, Godfrey Chan wrote: > @mrloz > > I think doing anything outside of modifying the database (seeding is > pushing it, but I think in some cases it is acceptable) is de

Re: [Rails-core] Correct Use or Naming of Migrations

2013-02-18 Thread Godfrey Chan
@mrloz I think doing anything outside of modifying the database (seeding is pushing it, but I think in some cases it is acceptable) is definitely a hack. The immediately obvious problem with that solution is that some of the tasks you described is not idempotent, such as sending emails. This might

Re: [Rails-core] Safe YAML

2013-01-31 Thread Godfrey Chan
In principle, I think this is a good idea. However, in order to pull this off without making assumptions of the underlying YAML parser, wouldn't you need to do something along the lines of multi_json to detect/load the desired YAML library, and then inject a different patch accordingly? (Or is this

Re: [Rails-core] Object#tap_if and Object#tap_unless

2013-01-25 Thread Godfrey Chan
cases! > > @Andrew Using if, the variable "users" is now available everywhere...I > only want it available in my block. > > > On Friday, January 25, 2013 2:05:31 PM UTC-8, Godfrey Chan wrote: > >> Object#try takes a block. It'll probably take car

Re: [Rails-core] Object#tap_if and Object#tap_unless

2013-01-25 Thread Godfrey Chan
Object#try takes a block. It'll probably take care of most simple cases for you: <% account.owner.try do |user| %> <% end %> On Fri, Jan 25, 2013 at 1:17 PM, Ngan wrote: > I originally brought this up in: > https://github.com/rails/rails/issues/9067 > > Rails paved the way for Object#tap a

Re: [Rails-core] How about a :without_type_cast => true option for validations?

2013-01-13 Thread Godfrey Chan
I would love to see this happen, I remember I had to do something like that for a few times in the past. On Sunday, January 13, 2013, Steve Jorgensen wrote: > One of the annoying problems with validations is that they are always > applied after typecasting. This means, for instance, that the :onl

Re: [Rails-core] Should the secret_token.rb be added to the .gitignore?

2013-01-11 Thread Godfrey Chan
That would break essentially all rails applications that uses a git-based deploy flow, such as Heroku and many other cap recipes. What might be a good idea though - is to use different secret token for each environment, and allow that to be specified through an ENV variable, like how the ActiveRec

Re: [Rails-core] Replace Test-Unit with Rspec

2013-01-10 Thread Godfrey Chan
Rails 4 actually uses minitest - which also offers a "lite" version of the spec style matchers. As for specifically why rspec is not the default, I suggest you google "DHH rspec" ;) On Thursday, January 10, 2013, Weston Platter wrote: > Maybe a dump question... > > Why is Test-Unit the default t

Re: [Rails-core] Generated model not always autoloadable

2012-11-11 Thread Godfrey Chan
Hi Peter, I did some investigation on a related issue a while ago which might be helpful to you. See GH #7132, #7134 and related (I think there might be more, but it's almost impossible to look them up on my phone right now). The way each of the inflector methods handle multi-word input had alw

Re: [Rails-core] Disable Time Zone Conversion for Specified Column

2012-10-18 Thread Godfrey Chan
Is it possible to offset the "damage" from rails by writing your own attr reader/writer? Sent from my phone On 2012-10-18, at 4:39 PM, Karl Smith wrote: > Pretty simple, I need to disable time zone conversion for specific columns. I > will handle any TZ conversion manually, but I need Rails 3

Re: [Rails-core] Customizable parameter name in routing.

2012-10-08 Thread Godfrey Chan
Pretty sure he meant Pascal On 2012-10-08, at 8:59 PM, Nickolas wrote: > But reasons indicated by Piotr are favourable. Why? > > вторник, 9 октября 2012 г., 1:47:47 UTC+4 пользователь Ryan Bigg написал: > -1 on this also for reasons Piotr explained. > > > > On 09/10/2012, at 8:13, Nickolas

Re: [Rails-core] Customizable parameter name in routing.

2012-10-08 Thread Godfrey Chan
> it seems to me that Rails is all about aliasing LOL... this made my day :D Sent from my phone -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe fro

Re: [Rails-core] Customizable parameter name in routing.

2012-10-08 Thread Godfrey Chan
He is talking about the other side when the URL parameters get deserialized into the params hash. You can alias the param name in a before_filter in your controller (or application controller if you need this everywhere): before_filter :alias_id private def alias_id params[:slug] = parmas.de

Re: [Rails-core] case insensitive inclusion validation

2012-10-02 Thread Godfrey Chan
Is there a use case where you wouldn't just do something like... validates :numbers, inclusion: { in: ['one', 'two'] } def numbers read_attribute(:numbers).try(:downcase) end i.e. Is there a particular reason why you still want the values to be stored/presented with potentially different case

Re: [Rails-core] attr_accessible with an :if option

2012-10-02 Thread Godfrey Chan
On 2012-10-02, at 6:46 AM, svoop wrote: > And maybe the gem even makes it into Rails 4. As Steve said, it already did :P -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups

Re: [Rails-core] attr_accessible with an :if option

2012-10-01 Thread Godfrey Chan
On 2012-10-01, at 5:27 PM, svoop wrote: > On Monday, October 1, 2012 11:00:07 PM UTC+2, Godfrey Chan wrote: > Shouldn't that be handled with validations? I mean you wouldn't save the > model without having a validation to ensure the value is consistent with the > state an

Re: [Rails-core] attr_accessible with an :if option

2012-10-01 Thread Godfrey Chan
Shouldn't that be handled with validations? I mean you wouldn't save the model without having a validation to ensure the value is consistent with the state anyways, so why not just take whatever value and let it blow up on validation? If you want to be nice to the user and silently ignore the at

Re: [Rails-core] Test Locations in Rails 4

2012-09-29 Thread Godfrey Chan
This is probably quite obvious, but I thought I'd point it out anyways. One big advantage of this schema is that there is a one-to-one corresponding between the content of the /app directory and the /test directory. This makes a lot of things very straightforward. For instance, when using guard

Re: [Rails-core] Test Locations in Rails 4

2012-09-29 Thread Godfrey Chan
+0.5 :) I'm using minitest-rails on my newer projects and I liked the structure you picked. It makes it easy to add tests for things like serializers (test/serializers), commands, etc. I think this would be a more reasonable choice of naming for new projects. I just don't know how this is going

Re: [Rails-core] Overring methods on engines

2012-09-28 Thread Godfrey Chan
4:20 AM, Godfrey Chan wrote: > If you are using Rails 3.2, you can tell Rails to load your engine before it > loads your app like so: > > config.railties_order = [ Your::Engine, :main_app, :all ] > > Then your monkey patching should work. > > If you are on older versions

Re: [Rails-core] Overring methods on engines

2012-09-28 Thread Godfrey Chan
If you are using Rails 3.2, you can tell Rails to load your engine before it loads your app like so: config.railties_order = [ Your::Engine, :main_app, :all ] Then your monkey patching should work. If you are on older versions of Rails you can monkey patch AS::Dependencies like http://www.slid

Re: [Rails-core] Good resource for the history of activerecord association method naming?

2012-09-21 Thread Godfrey Chan
Somehow this didn't go through the first time -- Several observations: 1. You're supposed to read them with the model name. So "a Post belongs_to an User" and "an User has_many Subscriptions". These two makes a lot of sense most of the time and reads very naturally, which seems consist

Re: [Rails-core] Good resource for the history of activerecord association method naming?

2012-09-21 Thread Godfrey Chan
Several observations: 1. You're supposed to read them with the model name. So "a Post belongs_to an User" and "an User has_many Subscriptions". These two makes a lot of sense most of the time and reads very naturally, which seems consistent among the nicer part of Ruby/Rails syntax (an object.i

[Rails-core] Re: [Proposal] Team issuebusters

2012-09-11 Thread Godfrey Chan
sues, ping the appropriate person to respond to it, or ask if it can be > close. Rails Core team always appreciate your contribution, and I'm pretty > sure they won't hesitate to give you out the permission to manage tickets > when it's time. > > Thank you so much for

Re: [Rails-core] [Proposal] Team issuebusters

2012-09-11 Thread Godfrey Chan
itate to give you out the permission to manage tickets when it's > time. > > Thank you so much for stepping up for this. > > - Prem > On Tuesday, September 11, 2012 at 11:28 AM, Godfrey Chan wrote: > >> As Richard pointed out in the other thread, we have a lot

[Rails-core] [Proposal] Team issuebusters

2012-09-11 Thread Godfrey Chan
As Richard pointed out in the other thread, we have a lot of open issues, and it'd be nice if we could do something about that. Evan tried to get people to review GH issues at Railsconf, and I believe there were some success there. Any interest in formalizing this effort and make it sustainable?

Re: [Rails-core] Polymorphic has_and_belongs_to_many association

2012-09-10 Thread Godfrey Chan
On 2012-09-10, at 8:02 AM, Josh Susser wrote: > The issue is that a polymorphic association requires that you query the db to > determine the class of the model, and you need that information to know what > table to query to get the record you want. Some SQL dbs provide some kind of > recursiv

Re: [Rails-core] datetime_select - change order of time and date

2012-09-07 Thread Godfrey Chan
For something like this you might want to just do it and send a PR, it sounds pretty reasonable so I don't think you'll have much trouble getting it merged :) On 2012-09-06, at 6:35 AM, Ex wrote: > date_select has option :order which provide array containing :day, :month and > :year. > > But d

Re: [Rails-core] Re: Feature Request: Provide documentation and/or feature to configure active record naming conventions

2012-08-30 Thread Godfrey Chan
You should look into ActiveModel::Naming. You might be able to override certain methods to return a custom subclass of ActiveSupport::Name to do what you want. YMMV Godfrey Sent from my phone On 2012-08-30, at 5:47 PM, Anthony Richardson wrote: > Same process here. We have a system that uses

Re: [Rails-core] respond_with and namespaced controllers

2012-08-29 Thread Godfrey Chan
> def create > respond_with :api, :v1, Topic.create(params[:topic]) > end That works great! Didn't make the connection between singleton resources and namespaces the first time I saw it. I'm quite happy with this solution! > Looking at your code, your model is not namespaced, so technically i

[Rails-core] respond_with and namespaced controllers

2012-08-29 Thread Godfrey Chan
# in routes.rb MyAwesomeSite::Application.routes.draw do namespace :api do namespace :v1 do resources :topics end end end # in app/controllers/api/v1/topics_controller.rb class API::V1::TopicsController < API::V1::APIController def create respond_with Topic.create(params[

Re: [Rails-core] Backporting instructions in Contributing guide

2012-08-13 Thread Godfrey Chan
+1 I think I wrote the original guide on back porting and this definitely sounds like a better approach. Godfrey Sent from my phone On 2012-08-13, at 10:27 AM, Rafael Mendonça França wrote: > On Mon, Aug 13, 2012 at 2:20 PM, Steve Jorgensen wrote: >> I'm probably going to help backport so

Re: [Rails-core] Any interest in "sudo" methods for bypassing mass-assignment?

2012-08-12 Thread Godfrey Chan
> but can't remember the syntax for "without_protection" At the risk of asking the obvious question, what exactly is so confusing about.. User.create({name: 'Pete', email: 'em...@example.com', account: Account.first}, without_protection: true) and… User.find(1).update_attributes({account: new_ac

[Rails-core] Inflector bug/inconsistent behaviour - what to do?

2012-07-23 Thread Godfrey Chan
Pull request/discussion here: https://github.com/rails/rails/pull/7134 (I'm not talking about adding inflector rules here, I'm aware the rules are frozen.) Summary of the ticket: I ran into an inflector bug lately. The root of the problem seems to be that no one really knows what singularize/p

[Rails-core] Staus of ActiveSupport PR #6802? (String#singular? and String#plural?)

2012-07-06 Thread Godfrey Chan
Can someone take a look at this pull request? I'm working on a different PR and there are a few places in the Rails source that needs to determine if a String is countable or not (example). I would submit a PR for String#countable? and String#uncountable? and refactor these checks, but because

Re: [Rails-core] Addition to has_many - a ':source_scope' option

2012-07-05 Thread Godfrey Chan
+1 for this. It would be nice if you could also throw in support for :unscoped (to counter the effect of a default_scope on the association), but I suppose even if this doesn't support that out of the box I could always make an "unfiltered" scope on the association. Sent from my phone On 2012-

[Rails-core] Model generators should fix plural names

2012-06-21 Thread Godfrey Chan
The original Github issue is here: https://github.com/rails/rails/issues/6809, moving the discussion here per Steve's suggestion. Long story short: 1. The resource (and hence scaffold) generator currently automatically detects and fix plural names for you 2. Confusingly, the model gen