Re: [Rails-core] Shouldn't "rails plugin new" create an Engine by default?

2012-06-05 Thread Rodrigo Rosenfeld Rosas
Thank you for your explanations, José. But don't you think that engines should be created by default by the "rails plugin new" command as I expect them to be more commonly used than railties or plugins? This is similar to Rails Metal. You can get a lighter controller using lower-level classe

Re: [Rails-core] Shouldn't "rails plugin new" create an Engine by default?

2012-06-05 Thread José Valim
> The point I'm trying to make is that there is no need for exposing so much details to extension developers. There is. Engine has a longer initialization process, more objects involved, etc. Why would you submit your app to a longer initialization process when there is no need to? Railties

Re: [Rails-core] Shouldn't "rails plugin new" create an Engine by default?

2012-06-05 Thread Rodrigo Rosenfeld Rosas
The point I'm trying to make is that there is no need for exposing so much details to extension developers. I'd prefer Rails 4 to only provide a single generator for an engine that would fit all other cases covered by plugins and railties. You don't have generators for Metal or other lightwei

Re: [Rails-core] Shouldn't "rails plugin new" create an Engine by default?

2012-06-05 Thread Luiz Felipe Garcia Pereira
http://api.rubyonrails.org/classes/Rails/Railtie.html "if you need to interact with the Rails framework during or after boot, then Railtie is needed" It shows examples of how to use a Railtie too. There is no real difference between a non-rails gem and a basic plugin. It's just pure ruby that gets

[Rails-core] Were global generators removed?

2012-06-05 Thread Rodrigo Rosenfeld Rosas
If I recall correctly it was possible to have some global generators in your user's home dir once. Was this feature removed? If so, why? Also, I can provide default options for "rails new" in ~/.railsrc and that is pretty useful. Is there some similar feature for "rails plugin new"? -- You r

Re: [Rails-core] Shouldn't "rails plugin new" create an Engine by default?

2012-06-05 Thread Rodrigo Rosenfeld Rosas
Em 05-06-2012 15:40, Luiz Felipe Garcia Pereira escreveu: The same rails guides like you pasted before shows a simple example of "just a plugin" when it just extends the core class String. I asked exactly what is the difference between this and a regular Ruby non-Rails gem. As for the diffe

Re: [Rails-core] Shouldn't "rails plugin new" create an Engine by default?

2012-06-05 Thread Luiz Felipe Garcia Pereira
The same rails guides like you pasted before shows a simple example of "just a plugin" when it just extends the core class String. As for the differences between Railties and Engines, I'll  quote the docs (http://guides.rubyonrails.org/engines.html): "A Rails::Engine is nothing more than a Railtie

Re: [Rails-core] Shouldn't "rails plugin new" create an Engine by default?

2012-06-05 Thread Rodrigo Rosenfeld Rosas
Em 05-06-2012 15:05, Luiz Felipe Garcia Pereira escreveu: One word: Modularity If it's a simple plugin, it doesn't need to be a Railtie and inserted in rails Could you please explain the differences about this and a regular Ruby gem? If it's something that extends rails/AR it can be a Railti

Re: [Rails-core] Shouldn't "rails plugin new" create an Engine by default?

2012-06-05 Thread Luiz Felipe Garcia Pereira
One word: Modularity If it's a simple plugin, it doesn't need to be a Railtie and inserted in rails If it's something that extends rails/AR it can be a Railtie and take advantage of that. If it's an engine then it makes sense to add the Engine and have the extra tools Rails::Engine provides. It's

Re: [Rails-core] Shouldn't "rails plugin new" create an Engine by default?

2012-06-05 Thread Rodrigo Rosenfeld Rosas
I'm not that lazy for avoiding to type "--full -T -O" every time I create a new gem. By the way I don't get why 's.add_development_dependency "sqlite3"' is added to gemspec when -O is specified. The problem here is that it seems inconsistent to me for a plugin not to be an Engine. I don't ev

Re: [Rails-core] Pull request nag: https://github.com/rails/rails/pull/6557

2012-06-05 Thread Rafael Mendonça França
I'll review it. Thank you. Rafael Mendonça França http://twitter.com/rafaelfranca https://github.com/rafaelfranca On Tue, Jun 5, 2012 at 1:55 PM, Steve Jorgensen wrote: > Hi all, > > I've had a pull request up for a while that I'd like to get > incorporated. Anything I can do to facilitate an

[Rails-core] Pull request nag: https://github.com/rails/rails/pull/6557

2012-06-05 Thread Steve Jorgensen
Hi all, I've had a pull request up for a while that I'd like to get incorporated. Anything I can do to facilitate an expeditious acceptance or informative rejection? This adds auto-reconnection for PostgreSQL if a connection is externally broken. Also includes build fixes and fixing fragile tests

Re: [Rails-core] Shouldn't "rails plugin new" create an Engine by default?

2012-06-05 Thread Luiz Felipe Garcia Pereira
It's a "rails plugin new" not "rails engine new". It doesn't create a default Engine because not all plugins are engines. If it's an engine and not just a plugin/railtie you would normally want the "--full" option. If not, just create it. It's only 4 lines of code. On Tue, Jun 5, 2012 at 1:25 PM

Re: [Rails-core] Shouldn't "rails plugin new" create an Engine by default?

2012-06-05 Thread Rodrigo Rosenfeld Rosas
But my engines usually don't have any routes and even those who have are not mountable ones. I'm just asking for an engine to be created even for non-mountable engines. I mean, as the default behavior of "rails plugin new plugin-name". The "--full" will add integration tests which I also don'

Re: [Rails-core] Shouldn't "rails plugin new" create an Engine by default?

2012-06-05 Thread Luís Ferreira
Yes. Just do "rails new plugin some_example --mountable". You should also take a look at --full. ;) On Jun 5, 2012, at 2:55 PM, Rodrigo Rosenfeld Rosas wrote: > What version are you talking about? That doesn't happen on latest stable > 3.2.5 here. > > If that is already implemented in master, t

Re: [Rails-core] Nested Resource Route Helpers

2012-06-05 Thread Andrew White
The only thing I really have to add to this conversation is that your routes are not necessarily mapped one to one to your models. You might have a nested url that is actually a different association but there's also an association matching the url - how do you tell it not to use the automatical

Re: [Rails-core] Nested Resource Route Helpers

2012-06-05 Thread John Mileham
On Tue, Jun 5, 2012 at 10:09 AM, Matt Jones wrote: > > On Jun 5, 2012, at 8:18 AM, John Mileham wrote: > > > > It's easy to dismiss as an obvious mistake, but I've seen it done too > many times to want to encourage deeply nested routes by automating the URL > generation. If your controller is fo

Re: [Rails-core] Nested Resource Route Helpers

2012-06-05 Thread Matt Jones
On Jun 5, 2012, at 8:18 AM, John Mileham wrote: > > It's easy to dismiss as an obvious mistake, but I've seen it done too many > times to want to encourage deeply nested routes by automating the URL > generation. If your controller is forced find the user from the project in > order to perfor

Re: [Rails-core] Shouldn't "rails plugin new" create an Engine by default?

2012-06-05 Thread Rodrigo Rosenfeld Rosas
What version are you talking about? That doesn't happen on latest stable 3.2.5 here. If that is already implemented in master, then great, I hope it to be backported to 3.2.6 when it gets released... Thanks, Rodrigo. Em 05-06-2012 10:22, Luís Ferreira escreveu: It creates the lib/some-examp

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

2012-06-05 Thread Rodrigo Rosenfeld Rosas
Em 05-06-2012 10:10, Maurizio Casimirri escreveu: Il giorno 05/giu/2012, alle ore 13.55, Rodrigo Rosenfeld Rosas ha scritto: ... Em 05-06-2012 00:17, Maurizio Casimirri escreveu:The problem relies in the gems in my opinion. They should follow the SRP instead of just assuming things to get a b

Re: [Rails-core] Shouldn't "rails plugin new" create an Engine by default?

2012-06-05 Thread Luís Ferreira
It creates the lib/some-example/engine.rb file which is just as you described and then requires it in lib/some-example.rb. Shouldn't that be enough? On Jun 5, 2012, at 2:10 PM, Rodrigo Rosenfeld Rosas wrote: > I've been creating several engines for Rails lately and I found that having > an engin

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

2012-06-05 Thread Maurizio Casimirri
Il giorno 05/giu/2012, alle ore 13.55, Rodrigo Rosenfeld Rosas ha scritto: > Em 05-06-2012 00:17, Maurizio Casimirri escreveu: >> >>> >>> Sorry, but I have no idea what you're talking about. Could you please give >>> me an example of one of those AR plugins you're referring to? >>> >> >> Sor

[Rails-core] Shouldn't "rails plugin new" create an Engine by default?

2012-06-05 Thread Rodrigo Rosenfeld Rosas
I've been creating several engines for Rails lately and I found that having an engine class inherited from Rails::Engine is required if you intend to bundle some Sprockets assets. So, shouldn't the template for "rails plugin new" change so that "rails plugin new some-example" would create some

Re: [Rails-core] Nested Resource Route Helpers

2012-06-05 Thread John Mileham
> > I feel like there definitely would be some security risk but I can't think > of a real, solid example. Can you lay one out for me? > Hi Michael, here's one example. Let's say that you must be the creator of a project to add issues to it (perhaps contrived in this case, but many access control

Re: [Rails-core] Nested Resource Route Helpers

2012-06-05 Thread Steve Klabnik
It's been long best practice to not nest more than one deep: http://weblog.jamisbuck.org/2007/2/5/nesting-resources -- 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

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

2012-06-05 Thread Rodrigo Rosenfeld Rosas
Em 05-06-2012 00:17, Maurizio Casimirri escreveu: Sorry, but I have no idea what you're talking about. Could you please give me an example of one of those AR plugins you're referring to? Sorry, you are right i was referring to gems that involve querying the database through AR, Devise to s

Re: [Rails-core] Nested Resource Route Helpers

2012-06-05 Thread Piotr Sarnacki
On Tue, Jun 5, 2012 at 4:28 AM, Michael Boutros wrote: > > As for actually implementing this, my train of thought is to use > ActiveRecord::Reflections to keep checking what a model belongs_to and then > calling that association. > There is no sane way to guess which association to use. "Issue" fr