[Rails-core] Re: [Feature] Add #except to Array

2020-02-29 Thread Alex Golubenko
I opened PR: https://github.com/rails/rails/pull/38611 среда, 26 февраля 2020 г., 6:21:35 UTC+2 пользователь Alex Golubenko написал: > > Hi guys! > > Time to time I meet questions on SO about how to take elements from array > avoid some indexes. > > I think it migh

Re: [Rails-core] [Feature] Add #except to Array

2020-02-27 Thread Alex Golubenko
se for such a function - I can understand > the special case of wanting to remove the first / last items in the array, > but an arbitrary one? > > On Wednesday, February 26, 2020 at 4:25:52 AM UTC-8, Alex Golubenko wrote: >> >> I'm totally agree that i

Re: [Rails-core] [Feature] Add #except to Array

2020-02-26 Thread Alex Golubenko
gt; > Would it be better to explicitly add the index to the name such as > `#except_index` or more verbose `#except_with_index` ? > > > > On Wednesday, February 26, 2020 at 8:49:07 AM UTC, Alex Golubenko wrote: >> >> It wouldn't be alias 😅 >> The main i

Re: [Rails-core] [Feature] Add #except to Array

2020-02-26 Thread Alex Golubenko
Would this alias Array#excluding? I think the Array#except is natural and > I’ve found myself asking why it’s not aliased already many times but I’m > not the one to ask. 🙂 > > Sent from my iPhone > > On Feb 25, 2020, at 10:21 PM, Alex Golubenko > wrote: > >  > Hi gu

[Rails-core] [Feature] Add #except to Array

2020-02-25 Thread Alex Golubenko
Hi guys! Time to time I meet questions on SO about how to take elements from array avoid some indexes. I think it might be helpful for many developers to have something like `Hash#except` but for `Array`. I would like to add PR with it if someone interested in it. Thanks in advance for any th

[Rails-core] Adding support for report-to directive to Content Security Policy DSL

2019-08-18 Thread Alex Cruice
Is there any appetite for accepting a small patch to the Content Security Policy DSL to support the report-to directive? There was previous discussion to replace report-uri, https://github.com/rails/rails/issues/33561. I agree with the reason for that issue's closure, CSP3 is still only in work

[Rails-core] Extend Content Security Policy DSL to support both enforce and report-only policies at the same time.

2019-08-18 Thread Alex Cruice
Unless I'm mistaken, the current DSL for managing the Content Security Policy doesn't appear to support producing both headers at the same time. I believe earlier CSP specifications, if both headers were present, instructed the user agent to ignore the report-only policy. This is no longer the

[Rails-core] [ActionDispatch] Don't preset `config.action_dispatch.always_write_cookie` based on environment while initializing app

2019-03-08 Thread Alex Shi
While I was dealing with cookies the other day, came across the commit https://github.com/rails/rails/commit/2d5a12a50bcd83fcc99865de759b82e661b28698 Currently, the prerequisites of writing cookie are following: + request.ssl?# SSL request + !cookie[:secure] # No

[Rails-core] Don't preset `config.action_dispatch.always_write_cookie` based on environment while initializing app

2019-03-08 Thread Alex Shi
While I was dealing with cookies the other day, came across the commit https://github.com/rails/rails/commit/2d5a12a50bcd83fcc99865de759b82e661b28698 The current implementation is a bit confusing. In development environment, it allows to write cookie, while no in other environments. Upon writ

[Rails-core] [ActiveStorage] Feature config.active_storage.mount_path

2018-03-13 Thread Alex Ganov
/direct_uploads(.:format) active_storage/direct_uploads#create Thanks! Alex -- 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 f

[Rails-core] Make has_one building syntax to look the same as for has_many

2016-04-08 Thread Alex Galushka
class User has_many :tips has_one :photo end user.tips.build(params) user.photo.build(params) Currently we have to use different syntax user.build_photo because user.photo can return nil. We can return some kind EmptyRecord instance the support the same methods that we have for has_many us

[Rails-core] #19085 - ActiveRecord::CollectionProxy#delete_all and ActiveRecord::Relation#delete_all do not follow the principle of least surprise

2015-03-05 Thread Alex Notov
As per a suggestion from Sean Griffin, I am moving the conversation about closed issue #19085 to this mailing list. I disagree with Sean about whether this is a bug or not, and hope to demonstrate that it is in fact a bug, as per the definition of

[Rails-core] ActiveRecord::CollectionProxy#delete_all and ActiveRecord::Relation#delete_all do not follow the principle of least surprise

2015-03-05 Thread Alex Notov
After speaking with Sean Griffin a bunch, I've decided to follow his lead and move the conversation here. I am happy to write and submit a PR for this issue, but wanted to have a discussion before doing that. Unfortunately, Sean had shut me down - and I think that was absolutely ridiculous, but

Re: [Rails-core] Re: Adding defaults from command line for generated migrations

2014-12-17 Thread Alex Soble
and make suggestions: https://github.com/rails/rails/pull/18075 Thanks! Alex On Sunday, December 14, 2014 6:31:22 PM UTC-6, EMoreth wrote: > > Hi, I actually have this on my projects, I still need to make it public, > but I was trying to make it more stable first. > > The main ide

Re: [Rails-core] Re: Adding defaults from command line for generated migrations

2014-12-02 Thread Alex Soble
n easy change as well. >> >> On Monday, December 1, 2014 4:18:47 PM UTC-6, Alex Soble wrote: >>> >>> Hi Rails core team, >>> >>> I've been mulling over an idea for a bit of new syntax, want to hear >>> what you think about it. >>>

[Rails-core] Adding defaults from command line for generated migrations

2014-12-01 Thread Alex Soble
Hi Rails core team, I've been mulling over an idea for a bit of new syntax, want to hear what you think about it. Two of the most common things I do as a developer when generating a new migration are (1) add defaults to help avoid nil errors and (2) add indices to attributes like foreign keys

[Rails-core] Re: StrongParameters .rename()

2014-04-10 Thread Alex K
I do so: params .tap { |whitelisted| whitelisted[:prices_attributes] = params[:prices] if params.has_key? :prices } .permit( :description, prices_attributes: [:attr_1, :attr_22], ... ) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Co

[Rails-core] Objects are compared by id, may be comparing by primary_key is more general

2014-01-28 Thread Alex Teut
As described in http://apidock.com/rails/v3.2.13/ActiveResource/Base/%3D%3D, objects are compared by classes and ids. For one of my models I use old_entity_hash as primary key. So I must check equality of two objects manually. I think that using their primary key as field to compare objects is

Re: [Rails-core] Remove :js responder

2013-12-02 Thread Alex
The mechanics of the vulnerability, which Egor's blog does not really communicate effectively, are, as I understand them: an evil site includes a

Re: [Rails-core] Remove :js responder

2013-11-28 Thread Alex
I believe the primary use case for js responder is remote forms, where you are not doing the request yourself, so a js response is the simplest and most natural approach there. This is not inherently insecure so should not be deprecated just because it does not feel good to some. On Thursday,

[Rails-core] specifying partial layout with a block to render

2013-11-19 Thread Alex
<%= render collection do %> <%= yield %> <% end %> there are many cases when you wouldn't want to create layout files -- 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, sen

[Rails-core] Re: rails server should optionally log to console the full exception stack trace

2013-11-18 Thread Alex
So, would this, in principle, be good to add? On Thursday, November 14, 2013 4:15:57 AM UTC-5, Alex wrote: > > AFAICT, it's not possible to force this currently. > > Frequently the application trace is inadequate and you need the full trace > to get to the bottom of the p

[Rails-core] rails server should optionally log to console the full exception stack trace

2013-11-14 Thread Alex
AFAICT, it's not possible to force this currently. Frequently the application trace is inadequate and you need the full trace to get to the bottom of the problem. For example, let's say your layout template calls non application (3rd party gem) code which raises. The application trace will co

Re: [Rails-core] ActiveRecord::Persistence.increment! requires a row lock to ensure isolated updates

2013-01-23 Thread Alex Sharp
On Wed, Jan 23, 2013 at 4:41 PM, Gabriel Sobrinho wrote: >> Since I have to keep a cache column of the paid value for the debt, I have >> 25 workers (sidekiq) that can call `increment!(:paid_value, >> paid_value)` >> and it should keep the total paid value. > > [SNIP] > > Yes, I'm thinking about

Re: [Rails-core] Re: ActiveRecord::Persistence.increment! requires a row lock to ensure isolated updates

2013-01-22 Thread Alex Sharp
On Tue, Jan 22, 2013 at 11:45 AM, Brendon Murphy wrote: > Side note on the updated_at column; the .update_counters method relies on > .update_all, so it does not bump the updated_at timestamp. This is not > that unexpected since the column timestamping is handled via the .create > and .update

Re: [Rails-core] Re: ActiveRecord::Persistence.increment! requires a row lock to ensure isolated updates

2013-01-22 Thread Alex Sharp
On Tue, Jan 22, 2013 at 10:39 AM, Pranas wrote: > It sounds like an interesting idea but I have some concerns. How about > value stored in AR instance? You wouldn't know what value was saved to > database unless you reload the record. > Yea, good point, the DB does not return updated value to th

Re: [Rails-core] Re: ActiveRecord::Persistence.increment! requires a row lock to ensure isolated updates

2013-01-22 Thread Alex Sharp
But increment is inherently subject to concurrency issues, and the only way to safely avoid them is to use a row level lock when incrementing the value, which presents a whole host of complications of its own. Cheers, Alex Sharp On Jan 22, 2013, at 7:00 AM, Carlos Antonio da Silva wrote

Re: [Rails-core] Re: ActiveRecord::Persistence.increment! requires a row lock to ensure isolated updates

2013-01-21 Thread Alex Sharp
Interesting. Hopefully we can get an explanation as to why the increment methods are not done this way, and if the core team would be open to a patch. - Alex On Monday, January 21, 2013 at 6:01 AM, Matt Huggins wrote: > Interestingly, ActiveRecord::CounterCache does this the appropriate

[Rails-core] Re: ActiveRecord::Calculations#sum returning a string..

2012-01-13 Thread alex
Just bumped into this. It's on line 323 now: https://github.com/rails/rails/blob/master/activerecord/lib/active_record/relation/calculations.rb#L323 I tried to go a way back like beginning of 2010 and it was still there. Not sure why a sum() would return a String, true. I currently converting it

[Rails-core] Re: Hitting 500 status code on invalid UTF-8 byte sequence in params

2011-09-18 Thread Alex Shulgin
On Sep 14, 5:15 pm, Alex Shulgin wrote: > > From what I can see, the problem has been noted in a more recent > version of Rails: > > https://github.com/rails/rails/blob/3-1-stable/actionpack/lib/action_... > >       # TODO: Validate that the characters are UTF-8. If they are

[Rails-core] Hitting 500 status code on invalid UTF-8 byte sequence in params

2011-09-14 Thread Alex Shulgin
ns to us, and since the data isn't coming from a webform we don't enjoy the mentioned form handling. I'd vote for a fix along the lines of Iconv.conv("#{$KCODE}//IGNORE", $KCODE, ...), but I'm not sure what would be a good place to apply that, more so that 2.3 and 3.x d

[Rails-core] Mail attachments not always recognized as present with tmail-1.2.7

2011-07-05 Thread Alex Shulgin
s/tmail/) lists 1.2.3.1 as the latest version. Where does this 1.2.7 bundled with ActionMailer comes from? -- Regards, Alex -- 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-

[Rails-core] Patch review request: #3721

2011-03-29 Thread Alex Shulgin
Hello, How can I get anyone to review a patch I posted to this (stalled) issue: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/3271 ? -- Regards, Alex -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To po

[Rails-core] [Patch] Add an option to explicitly omit the creation of hidden field with object id

2011-03-01 Thread Alex
Some NoSQL "ORMs" allows to create inline associations, in this case associated objects does not have its own IDs. An option to omit the creation of hidden field with associated object id would be useful. This is 3 lines patch with ~10 months history. Could anyone finish it please? https://rails.l

[Rails-core] Re: ActiveModel::AttributeMethods limiting

2011-02-24 Thread Alex
Could anyone take a look at this ticket? https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/6428 -- 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 u

[Rails-core] Re: ActiveModel::AttributeMethods limiting

2011-02-13 Thread Alex
Done. Ticket with patch https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/6428 On Feb 7, 5:46 pm, Santiago Pastorino wrote: > Hey Alex, if you want go ahead and try a fix ;). -- You received this message because you are subscribed to the Google Groups "Ruby on Rai

[Rails-core] ActiveModel::AttributeMethods limiting

2011-02-04 Thread Alex
In my attempt to add AM:Dirty to my model I realized that AM#AttributeMethods is a bit imperfect. It's impossible to generate attribute methods step-by-step in DataMapper-like manner. class Model include ActiveModel::Dirty def self.property(name, klass = String) define_property_ac

[Rails-core] Ability to omit hidden field with id in fields_for helper

2010-06-17 Thread Alex
Some ORM's offers inline associations with id-less objects. A number of patches included for variety's sake. https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4551 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post

[Rails-core] Postgres plpgsql is created by default in new version, but schema dump tries to create it

2010-03-09 Thread Alex
As of some recent version of Postgres, plpgsql is created for new databases by default, but the sql schema export (config.active_record.schema_format = :sql) expots a create command in development_structure.sql, resulting in an error. CREATE PROCEDURAL LANGUAGE plpgsql; I could not find the vers

Re: [Rails-core] wishlist: admin controller

2010-01-09 Thread Alex Barlow
Hi Tom, the feature is coming in rails three, since merb and rails are merging, the merb admin, is now in rails, optionally, of course Check the github commits or rails blog for details.. On 9 Jan 2010, at 16:44, tom wrote: > hi, > > i "always" end up creating an admin "backend" controller to

Re: [Rails-core] ROR Upload Problems on Windows

2010-01-07 Thread Alex Barlow
Try using the File.open("myfile", "a"), also the rdocs for the io class describes the different types Sent from my iPhone On 7 Jan 2010, at 19:10, timjd wrote: I'm pretty new to ROR and working on a couple of small changes to an upload function, changing how the input spreadsheet is parsed.

[Rails-core] Re: Truncating a utf8 string

2009-07-13 Thread Alex
; On Jul 13, 2009, at 10:30 AM, Alex wrote: > > > > > I have a utf8 string that I need to truncate, but I want to obviously > > make sure it is truncated at a character boundary. > > > s.slice does not ensure that. > > > Is there a clean fast way to do t

[Rails-core] Truncating a utf8 string

2009-07-13 Thread Alex
I have a utf8 string that I need to truncate, but I want to obviously make sure it is truncated at a character boundary. s.slice does not ensure that. Is there a clean fast way to do that? --~--~-~--~~~---~--~~ You received this message because you are subscribed

[Rails-core] Re: Simple hash serlializable object

2009-07-11 Thread Alex
Pat, thanks for that great example! On Jul 8, 1:50 pm, Pat Nakajima wrote: > I think that Struct might be your best > bet:https://gist.github.com/afe18b5713b036e2324f > It'll disallow invalid keys, plus, is way faster than OpenStruct. > > Pat > > > > On W

[Rails-core] Re: Simple hash serlializable object

2009-07-08 Thread Alex
false} > > I don't see the benefit of using a block though, it only adds another   > line. > > HTH, > Eloy > > On Jul 7, 2009, at 8:42 AM, Alex wrote: > > > > > > > I frequently find the need to have an object with specific attributes, >

[Rails-core] Re: Simple hash serlializable object

2009-07-08 Thread Alex
end > >    def to_hash >     �...@table >    end > end > > f = HashableStruct.from_hash(:bar => true, :none => false) > p f # => # > p f.to_hash # => {:bar=>true, :none=>false} > > I don't see the benefit of using a block though, it only adds anoth

[Rails-core] Simple hash serlializable object

2009-07-06 Thread Alex
I frequently find the need to have an object with specific attributes, preferably initializable with a code block and/or a hash, that I also want serializable/deserializable to a hash. Example: class Foo attr_accessor :bar, :none end foo = Foo.new do |f| f.bar = true f.none = false end p

[Rails-core] Re: Any reason why after_save & after_create are wrapped in the transaction?

2009-03-10 Thread Alex MacCaw
Here's a little lib I wrote that implements support for after_commit callbacks: http://gist.github.com/76868 On Mon, Mar 9, 2009 at 2:43 PM, Alex MacCaw wrote: > > Yes, I'm still getting the error. > > On Mar 9, 2:39 pm, Jan De Poorter wrote: > > As far as I can se

[Rails-core] Re: Any reason why after_save & after_create are wrapped in the transaction?

2009-03-09 Thread Alex MacCaw
Yes, I'm still getting the error. On Mar 9, 2:39 pm, Jan De Poorter wrote: > As far as I can see observers after_save calls are still in the   > transaction. > > regards, > Jan De Poorterhttp://workswithruby.com > > On 07 Mar 2009, at 18:31, Alex MacCaw wrote

[Rails-core] Re: Any reason why after_save & after_create are wrapped in the transaction?

2009-03-07 Thread Alex MacCaw
Thanks for the suggestion, will do. On Mar 7, 4:43 pm, Pratik wrote: > On Sat, Mar 7, 2009 at 4:40 PM, Eloy Duran wrote: > > So maybe a patch to add the after_commit API, as used in the article, > > would be a good idea. > > Or if possible, just use observers. > -- > Cheers! > - Pratikhttp://m.

[Rails-core] Re: Any reason why after_save & after_create are wrapped in the transaction?

2009-03-07 Thread Alex MacCaw
us state. > > So maybe a patch to add the after_commit API, as used in the article,   > would be a good idea. > > Eloy > > On 7 mrt 2009, at 15:34, Alex MacCaw wrote: > > > > > I've got a message queue running, and record ids get added to it in an > > a

[Rails-core] Any reason why after_save & after_create are wrapped in the transaction?

2009-03-07 Thread Alex MacCaw
I've got a message queue running, and record ids get added to it in an after_create callback. However, the message queue is so fast that it can't find the records. This is because the record hasn't actually been saved back to the database yet - after_create is called in the transaction. There's

[Rails-core] Proposed Cache API extensions

2008-12-04 Thread Alex MacCaw
Just wanted to run this by a few people to get some feedback. At the moment, fragment cache (as indeed Rails.cache) calls often look a bit like this: <% cache("[EMAIL PROTECTED]") do %> I was thinking cache should take multiple arguments, which would be joined with an underscore, like this: <% c

[Rails-core] Should mongrel be the default server?

2008-07-18 Thread Alex MacCaw
I'm just wondering about the switch from mongrel to thin as the default server. I'm not sure it's such a good one, considering that the --debugger option doesn't work for example. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goo

[Rails-core] Re: Any comments on this ActionCaching patch?

2008-03-06 Thread Alex Chaffee
> > That's presumably page-caching rather than action-caching, right? Yes, that's right, on this app we're doing all page caching, no action or fragment caching. - A --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[Rails-core] Re: Any comments on this ActionCaching patch?

2008-03-05 Thread Alex Chaffee
t you do: 1. gem install feedtools 2. clear your cache 3. use FeedTools to hit your page (in our case, /blabs) -- note that it's not specifying .atom in the URL, but in the Accept header require 'feed_tools' feed = FeedTools::Feed.open

[Rails-core] Re: rake db:test:prepare

2008-02-21 Thread Alex Chaffee
For an alternative see my article at http://pivots.pivotallabs.com/users/alex/blog/articles/305-collapsing-migrations If you make it part of your process to regularly collapse migrations (like after every deploy), you avoid both of the problems mentioned above (referencing old class definitions

[Rails-core] submitted patch 10290 - add reset_tag helper method.

2007-11-26 Thread Alex L
I found myself wishing I could create a form reset button as easily as I can a submit button. So, now I can. If you apply this patch, you can too! http://dev.rubyonrails.org/ticket/10290 If you have any forms with reset buttons, please try out this patch and comment on the ticket. This is my fi