Re: [Rails-core] Why is ActiveResource::Base.site a class variable?

2009-12-13 Thread Michael Koziarski
Questions: * Is there a reason it can't/shouldn't be an instance variable? What would the api look like here?  I could see something like Seems I didn't hit paste... ActiveResource::Base.with_site(...) do ShopifyAPI::Shop.find(:first) # etc. end -- Cheers Koz -- You received this

[Rails-core] Re: Person.first(n) and Person.last(n) to work like Array#first and Array#last

2009-12-13 Thread Adam
The #first and #last class methods on ActiveRecord::Base are examples of Rails cleverness gone a little over the edge. Who hasn't run into this problem?: Person.blog_posts.first # = #BlogPost name='foo' Person.blog_posts.first.name = 'bar' Person.blog_posts.first # = #BlogPost name='foo' The

[Rails-core] Re: Person.first(n) and Person.last(n) to work like Array#first and Array#last

2009-12-13 Thread Stephen Celis
On Dec 13, 3:25 pm, Adam amilli...@pivotallabs.com wrote: The #first and #last class methods on ActiveRecord::Base are examples of Rails cleverness gone a little over the edge. The cleverness may go a little over the edge, but, to add to your list of general confusion with these

Re: [Rails-core] Why is ActiveResource::Base.site a class variable?

2009-12-13 Thread Yehuda Katz
Long-term, we want to try to get away from using global state like this as much as possible, but fixing it can sometimes open a thorny can of worms. Koz's solution, paired with a mutex or thread-local (for threadsafe scenarios) is a good workaround for now. Sent from my iPhone On Dec 13, 2009,

Re: [Rails-core] Why is ActiveResource::Base.site a class variable?

2009-12-13 Thread Chad Woolley
On Sun, Dec 13, 2009 at 4:40 PM, Yehuda Katz wyc...@gmail.com wrote: Long-term, we want to try to get away from using global state like this as much as possible, but fixing it can sometimes open a thorny can of worms. Koz's solution, paired with a mutex or thread-local (for threadsafe

[Rails-core] Rails 3 bug with application generator

2009-12-13 Thread Trevor Turk
I just wanted to draw some attention to a bug I noticed when first trying to play with Rails 3 by generating a new application. https://rails.lighthouseapp.com/projects/8994/tickets/3556-app_generator-should-disallow-or-fix-invalid-app_const The short version is that running rails test-project

Re: [Rails-core] Person.first(n) and Person.last(n) to work like Array#first and Array#last

2009-12-13 Thread Will Bryant
On Sun, Dec 13, 2009 at 6:18 AM, Mislav Marohnić mislav.maroh...@gmail.com wrote: I'm not sure. AR::Base subclasses don't act like Arrays, so I don't think we should be matching same-named method implementations just for the sake of doing so, regardless of how sweet the syntactic sugar is.