[Rails-core] Re: Nested Resource Route Helpers

2012-06-07 Thread Michael Boutros
You guys are right. It would be too much work that would only work 
(accurately) if the three models had strictly one relationship. We could 
find ways to ensure a greater accuracy but it wouldn't be worth it. And 
like John said, it has the potential to be greatly misused and open a can 
of security worms. I'll just stick to what I'm doing now. Thanks :)

On Monday, June 4, 2012 1:10:50 PM UTC-4, Michael Boutros wrote:

 Hello all,

 I'm working on a Rails app and I have resources nested three deep - let's 
 call them user, project, and issues. The route helpers now look like 
 user_project_issue_path(@user, @project, @issue). Would it make sense for 
 Rails to guess the @user https://github.com/user and 
 @projecthttps://github.com/project relations 
 from @issue https://github.com/issue? It just feels like a lot of 
 redundant and non-DRY code. I'm willing to write the code myself (or die 
 trying), but I just wanted to make sure this isn't by design.

 - Michael Boutros


On Monday, June 4, 2012 1:10:50 PM UTC-4, Michael Boutros wrote:

 Hello all,

 I'm working on a Rails app and I have resources nested three deep - let's 
 call them user, project, and issues. The route helpers now look like 
 user_project_issue_path(@user, @project, @issue). Would it make sense for 
 Rails to guess the @user https://github.com/user and 
 @projecthttps://github.com/project relations 
 from @issue https://github.com/issue? It just feels like a lot of 
 redundant and non-DRY code. I'm willing to write the code myself (or die 
 trying), but I just wanted to make sure this isn't by design.

 - Michael Boutros


-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Core group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-core/-/kAwh0oTe4qUJ.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-core+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.



[Rails-core] Another pull request nag -- PostgreSQL auto-reconnection, take 2

2012-06-07 Thread Steve Jorgensen
Hi all,

I have a new pull request pending: https://github.com/rails/rails/pull/6654

This is a new stab at making PostgreSQL auto-reconnection work properly. 
Adds test coverage to the code that is already supposed to be making the 
automatic reconnection work, and fixes a problem that was demonstrated by 
the tests.

-- Steve J.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Core group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-core/-/2JtfVvdUQe8J.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-core+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.



Re: [Rails-core] Making touch more efficient

2012-06-07 Thread Matt Jones

On Jun 7, 2012, at 6:55 PM, Spike wrote:

 I'm currently working on a Rails 2.3 project but I think the code hasn't 
 changed much around touching in the latest release so here goes:
 
 Touching seems to be less efficient than it could be. Currently it seems to 
 change the updated_at (or other) field, save the whole object, trigger all 
 callbacks on that object (some of which might be to touch other associated 
 objects) and so on.
 
 Seems to me that there could be performance gains made (especially when it 
 comes to deleting and cloning deeply nested relational structures) by making 
 touch only update_attribute the appropriate fields, and then only call the 
 associated touch callbacks (because they're already named well they can be 
 identified) and so on.
 
 Is there a reason why it's not does this way already?

The implementation in Rails 3 is entirely different:

http://api.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-touch

It now skips all the callbacks, etc entirely.

--Matt Jones

-- 
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 from this group, send email to 
rubyonrails-core+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.