Re: [Rails-core] Re: proposing Object#nonblank? (analogous to Ruby's Numeric#nonzero?)

2009-12-29 Thread Allen Madsen
k has significance. Allen Madsen http://www.allenmadsen.com On Tue, Dec 29, 2009 at 1:27 AM, Andrew White wrote: > On 28 Dec 2009, at 18:04, Josh Susser wrote: > > > That's reasonably concise, but just keep in mind that all of this is > > just to make Ruby act more like Perl w

Re: Undefining object_id (was Re: [Rails-core] Re: proposing Object#nonblank? (analogous to Ruby's Numeric#nonzero?))

2009-12-29 Thread Allen Madsen
I believe ruby uses it internally to track the objects. If you change or remove the object_id, then nothing will be referencing that object and the garbage collector will eat it up. All this is heresay though, until someone confirms it. Allen Madsen http://www.allenmadsen.com On Tue, Dec 29

Re: [Rails-core] try method under ActiveModel

2009-12-31 Thread Allen Madsen
Rodrigo, You should be doing something like: class NewString < String def initialize(options={}) @options = options end def to_s @options[:message] end end That will give you the desired result. Allen Madsen http://www.allenmadsen.com On Thu, Dec 31, 2009 at 4:11 PM, Rodr

Re: [Rails-core] Overriding the default rails app generator - how?

2010-01-28 Thread Allen Madsen
You could have the gem install the thor task for you. That way you only get the task if the gem is available. Allen Madsen http://www.allenmadsen.com On Thu, Jan 28, 2010 at 9:36 AM, Kristian Mandrup wrote: > Hi, > > I have been working a lot on getting a grasp of creatin

Re: [Rails-core] Re: Rails 3 : basic routes

2010-02-15 Thread Allen Madsen
I agree with Trey. People learning Rails should be learning the conventions, not the exceptions. As for the learning curve, I think it is simple enough to generate a scaffold. Allen Madsen http://www.allenmadsen.com On Mon, Feb 15, 2010 at 8:53 PM, Trey wrote: > Hey Anthony, > &

Re: [Rails-core] Rails3 jquery_helper

2010-04-12 Thread Allen Madsen
The idea as it stands now is that the abstraction will happen at the javascript layer. So there will be a common rails javascript library that supports adapters to the other javascript libraries. prototype_helper should go away completely and be replaced by a rails common javascript helper. Allen

Re: [Rails-core] Re: Rails3 jquery_helper

2010-04-12 Thread Allen Madsen
It doesn't exist yet. Currently it's an idea for a RubySoC project [1]. When I get time this week or next I'll be writing a proposal for it. [1] http://wiki.rubyonrails.org/rubysoc/2010/ideas#action_view Allen Madsen http://www.allenmadsen.com On Mon, Apr 12, 2010 at 8:47 PM,

Re: [Rails-core] Re: Request: Make UrlHelper methods available for controllers

2010-05-13 Thread Allen Madsen
Kristian, If I understand what you are trying to do, then its a little backwards. You really shouldn't be generating view stuff in the controller. Instead you can create a class variable like @logged_in and then use that to selectively show certain components in the view. Allen Madsen

Re: [Rails-core] [BUG] [PATCH] AS::MB::Chars concatenation with + (plus) method should not alter the original

2010-05-19 Thread Allen Madsen
+1 Allen Madsen http://www.allenmadsen.com On Wed, May 19, 2010 at 9:53 AM, Norman Clarke wrote: > On Tue, May 18, 2010 at 16:47, James MacAulay wrote: >> Small but nasty bug, tested and fixed: >> >> https://rails.lighthouseapp.com/projects/8994-ruby-on-r

Re: [Rails-core] Re: Default JavaScript library

2010-05-25 Thread Allen Madsen
I don't particularly care which is the default, but I think it should be easy to pick either. Maybe a flag on the rails command like -d for the database. You could do something like: rails myapp -j=jquery Allen Madsen http://www.allenmadsen.com On Mon, May 24, 2010 at 6:10 PM, Yehuda

Re: [Rails-core] Merge db:migrate + db:test:prepare

2010-09-21 Thread Allen Madsen
I personally have never used `rake db:test:prepare`. I generally use `rake db:migrate RAILS_ENV=test`. Something more concise is welcome. Allen Madsen http://www.allenmadsen.com On Tue, Sep 21, 2010 at 12:00 PM, radhames brito wrote: > > nothing intrigues me more than db:test

Re: [Rails-core] Merge db:migrate + db:test:prepare

2010-09-21 Thread Allen Madsen
If I understand you right, you're saying `rake db:test:prepare` is synonymous with `rake db:schema:load RAILS_ENV=test` instead of migrate. Allen Madsen http://www.allenmadsen.com On Tue, Sep 21, 2010 at 12:04 PM, Xavier Noria wrote: > Not sure I follow. > > You do not need an

Re: [Rails-core] Merge db:migrate + db:test:prepare

2010-09-21 Thread Allen Madsen
There may be valid reasons to not have your database on the most recent migration. It would be difficult for rails to know when it should go to the newest version and when it should stay at a particular one. Allen Madsen http://www.allenmadsen.com On Tue, Sep 21, 2010 at 12:06 PM, Ryan Bigg

Re: [Rails-core] Rails validations and concurrency

2010-10-31 Thread Allen Madsen
I might be wrong in understanding the problem, but I believe I would use transactions to solve the problems you're describing. I don't see the need to manage locks manually. Allen Madsen http://www.allenmadsen.com On Sun, Oct 31, 2010 at 7:28 AM, Rodrigo Rosenfeld Rosas wrote: &

Re: [Rails-core] Re: has_many :through deletion and destruction

2010-12-21 Thread Allen Madsen
Proposal sounds reasonable to me. +1 Allen Madsen http://www.allenmadsen.com On Tue, Dec 21, 2010 at 11:17 AM, PivotalBoulderMikeG wrote: > Aaron, > > What's the best way to make some noise about this?  Tell people about > this thread? > > MIke > > On Dec 21,

Re: [Rails-core] Re: Email and URL validators in ActiveModel

2011-02-12 Thread Allen Madsen
+1 for URL and email validators. Allen Madsen http://www.allenmadsen.com On Sat, Feb 12, 2011 at 4:19 AM, Xavier Noria wrote: > On Fri, Feb 11, 2011 at 7:38 PM, Rodrigo Rosenfeld Rosas > wrote: > > > validates_format_of :email, :with => > > /\A([^@\s]+)@((?:[-a-

Re: [Rails-core] rake issues

2011-03-04 Thread Allen Madsen
Hey Prem, I don't see `db:reset` in the list. Allen Madsen http://www.allenmadsen.com On Fri, Mar 4, 2011 at 9:36 AM, Prem Sichanugrist wrote: > Hi Rodrigo, > > I cannot reproduce your problem on latest 3.0.5. Here's my gist showing the > test: https://gist.github.com/85

Re: [Rails-core] Question about "KnownIP".tableize

2011-04-03 Thread Allen Madsen
It also says, in the docs you linked to: As a rule of thumb you can think of underscore as the inverse of camelize, though there are cases where that does not hold: "SSLError".underscore.camelize # => "SslError" So the situation you're talking about is a known sho

Re: [Rails-core] Fedena installation: Error

2011-04-08 Thread Allen Madsen
ed to solve. However, since it looks like you're just trying to get this to run, you could just uninstall the newest version of prawn and there's a good chance things will work out. If not, you'll have to go version hunting for compatible gems or retrofit the project to use Bundler

Re: [Rails-core] Problem with dup in HashWithIndifferentAccess

2011-06-13 Thread Allen Madsen
)) This is idiomatic ruby behavior and shouldn't be affected by rails, though I can't say for certain it isn't. [1]: http://www.ruby-doc.org/core/classes/Object.html#M001015 Allen Madsen http://www.allenmadsen.com On Mon, Jun 13, 2011 at 12:20 AM, gerberdata wrote: > Hi not sure

Re: [Rails-core] rails 3.1rc4, Engine rather broken

2011-07-07 Thread Allen Madsen
Perhaps the issue is related to passing "mounable" instead of "mountable": rails plugin new myengine --mountable Allen Madsen http://www.allenmadsen.com On Thu, Jul 7, 2011 at 11:10 AM, mrloz wrote: > Hi there. > > I'm having some real issues with engines an

Re: [Rails-core] Javascript is now a first-class code citizen - Really?!

2011-08-31 Thread Allen Madsen
What Rodrigo said. +1 for jasmine Allen Madsen http://www.allenmadsen.com On Wed, Aug 31, 2011 at 6:11 PM, Rodrigo Rosenfeld Rosas wrote: > ** > When you do that, it would be similar to not adding tests on generators or > not providing Coffeescript or SASS support in a default

Re: [Rails-core] Google Summer of Code - 2012

2012-02-15 Thread Allen Madsen
I don't think it was quite as drastic as not allowed. If I remember correctly, it was just that it wasn't picked from all the open source projects that applied. Allen Madsen http://www.allenmadsen.com On Wed, Feb 15, 2012 at 4:31 PM, Steve Klabnik wrote: > Isn't Ruby not a

Re: [Rails-core] Attribute query methods and semantics

2012-05-31 Thread Allen Madsen
decide what is best for their specific case. If you're on a team, set a style guide that picks a winner. Allen Madsen http://www.allenmadsen.com On Thu, May 31, 2012 at 11:05 AM, Maksym Melnychok wrote: > On Thursday, May 31, 2012 4:50:05 PM UTC+2, Steve Klabnik wrote: >> >> It&

Re: [Rails-core] ActiveRecord interface to Arel is awkward, requires find_by_sql(query.to_sql)

2012-06-04 Thread Allen Madsen
Squeel (not to be confused with Sequel) does a pretty good job of covering the other 20%. https://github.com/ernie/squeel Allen Madsen http://www.allenmadsen.com On Mon, Jun 4, 2012 at 6:24 PM, Maurizio Casimirri wrote: > > Il giorno 04/giu/2012, alle ore 23.27, Bruce Perens ha s

Re: [Rails-core] Why do I need to require my gem in application.rb so that I can use its settings in production?

2012-07-15 Thread Allen Madsen
You'd want to move your gem out of assets if you want it to be available in other environments on heroku. Allen Madsen http://www.allenmadsen.com On Sun, Jul 15, 2012 at 8:13 AM, Rodrigo Rosenfeld Rosas wrote: > I've released a new Engine yesterday, called oojspec: > >

Re: [Rails-core] Why do I need to require my gem in application.rb so that I can use its settings in production?

2012-07-15 Thread Allen Madsen
These comments in your gemfile explain why: https://github.com/rosenfeld/oojspec-test/blob/master/Gemfile#L10:L11 Allen Madsen http://www.allenmadsen.com On Sun, Jul 15, 2012 at 8:57 AM, Allen Madsen wrote: > You'd want to move your gem out of assets if you want it to be available &g

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

2012-10-02 Thread Allen Madsen
This pull request poses two problems in my mind. The changes are not backwards compatible, which could lead to some serious head scratching. Secondly, even though they're a standard now, they're not commonly used, which leads to more head scrathing. Allen Madsen http://www.allenmadse

Re: [Rails-core] Suggestion: default values for models

2012-10-18 Thread Allen Madsen
This is relevant: http://stackoverflow.com/questions/328525/what-is-the-best-way-to-set-default-values-in-activerecord They mention using after_initialize. Allen Madsen http://www.allenmadsen.com On Thu, Oct 18, 2012 at 8:50 AM, Gabriel Sobrinho < gabriel.sobri...@gmail.com> wrote: >

Re: [Rails-core] Re: Pull request #1731: enable/disable strong parameters

2012-10-25 Thread Allen Madsen
Check out https://github.com/thoughtbot/appraisal Allen Madsen http://www.allenmadsen.com On Thu, Oct 25, 2012 at 12:57 PM, Gary Weaver wrote: > Request denied by dhh. See pull request for reasons. Sounds like > strong_parameters is living up to its name. It won't be taken down by

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

2013-02-21 Thread Allen Madsen
At Gazelle, we essentially copy the migration rake tasks and call them iterations. So, as you'd imagine: rake iteration:migrate # like rake db:migrate We use it for data only changes. Allen Madsen http://www.allenmadsen.com On Thu, Feb 21, 2013 at 3:17 PM, Duncan Beevers wrote: > O

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

2013-02-27 Thread Allen Madsen
Here's the task I alluded to if anyone is interested: https://gist.github.com/blatyo/5047690 Allen Madsen http://www.allenmadsen.com On Thu, Feb 21, 2013 at 3:26 PM, Allen Madsen wrote: > At Gazelle, we essentially copy the migration rake tasks and call them > iterations. So, as yo

Re: [Rails-core] bang query methods (where!, includes!, etc.) cause indeciperable errors when called on model class

2013-11-05 Thread Allen Madsen
class is a global object, scopes originate from there, and any piece of code could modify the behavior of that global, it would introduce side effects throughout an application. Ideally, when side effects are present, they're localized to a small scope. Allen Madsen http://www.allenmadsen.com

Re: [Rails-core] rake db:migrate should not invoke dump task in production environment

2014-01-31 Thread Allen Madsen
I agree. Just yesterday, I wrote a separate task that only did migrations for deploy. Allen Madsen http://www.allenmadsen.com On Fri, Jan 31, 2014 at 1:13 PM, Emil S wrote: > Currently the `db:migrate` rake task runs `dump` at the end which dumps > the database structure to `sch

Re: [Rails-core] X-Runtime header doesn't seem to be reliable

2014-02-19 Thread Allen Madsen
Completely wild guess, but the issue you're seeing could be related to the fact that you're running in development mode. I wouldn't trust any benchmark unless the app was in production mode. One reason is the code reloading in development mode. Allen Madsen http://www.allenmads

Re: [Rails-core] Validation the presence of an ActiveRecord belongs_to association should imply a valid associated object?

2014-09-11 Thread Allen Madsen
:profile, required: true end Hope that helps, Allen Madsen http://www.allenmadsen.com On Wed, Sep 10, 2014 at 9:47 PM, Aaron Kromer wrote: > This behavior has been around for awhile (since at least 3.2.x; I didn't > test further back). I'm a bit surprised this didn't trip my

Re: [Rails-core] Re: Rails.application.config_for and Rails.config.x

2014-09-17 Thread Allen Madsen
The best name for "x" that I can think of would be "for". `config.for.redis.host` Allen Madsen http://www.allenmadsen.com On Wed, Sep 17, 2014 at 9:22 AM, Mohamed Wael Khobalatte wrote: > config_for is better because it signals that you are doing non-standard > confi

Re: [Rails-core] If It's needed?

2015-06-12 Thread Allen Madsen
You can pass index options instead of true. For example: ``` t.references :vancancy, index: {name: :my_great_name} ``` Allen Madsen http://www.allenmadsen.com On Fri, Jun 12, 2015 at 11:12 AM, Egor Vorobiev wrote: > Hi, Folks! > > I wrote this. >

Re: [Rails-core] ActiveRecord should have a create-like method that throws 400 on invalid record

2016-02-17 Thread Allen Madsen
You can already do this. Call create! and rescue ActiveRecord::RecordInvalid. http://api.rubyonrails.org/classes/ActiveRecord/Persistence/ClassMethods.html#method-i-create-21 Allen Madsen http://www.allenmadsen.com On Wed, Feb 17, 2016 at 2:40 PM, Daniel Finlay wrote: > I'd like to

Re: [Rails-core] Increase performance

2016-05-06 Thread Allen Madsen
00 million times. If you can demonstrate that the place containing the `loop` is a hotspot that gets executed many times in a request, then the optimization is probably justified. That's why it wouldn't just be a find and replace for all instances. Allen Madsen http://www.allenmadsen.com On

Re: [Rails-core] [Feature Request] Boolean methods for STI models

2016-05-20 Thread Allen Madsen
ad do: company.do_thing Then each subclass of company would implement the correct behavior for that case. For the behavior you described, you may be better served with Rails enum support: http://api.rubyonrails.org/v4.1/classes/ActiveRecord/Enum.html Allen Madsen http://www.allenmadsen.com On Fri, May 20, 2016

Re: [Rails-core] Organize models in subfolders

2017-02-24 Thread Allen Madsen
I believe everything under app/models is loaded by default, so you shouldn't need to add a subdirectory. Allen Madsen http://www.allenmadsen.com On Fri, Feb 24, 2017 at 10:49 AM, Maurizio De Santis < desantis.mauri...@gmail.com> wrote: > [From the issue I opened about it: http