Hey Sean and Jacques,
I'd definitely be interested in helping work out how to ease the transition.
In the case of the two examples cited by the original poster, check this
out:
module Myapp
class Controller < ActionController::Metal
abstract!
include *ActionController::Base.modules_without(:ImplicitRender)
alias render render_to_string
def send_action(*)
self.response_body = super
end
ActiveSupport.run_load_hooks(:action_controller, self)
end
end
If you then inherit from MyApp::Controller, you'll have the explicit render
behavior of Merb.
def url(name, *args)
route = _router.named_routes[name]
options = args.extract_options!
options.reverse_merge!(:only_path => true)
options[:_positional_args] = args
options[:_positional_keys] = route.segment_keys
url_for(options)
end
This provides an url() method that allows you to pass in a Symbol as the
key. You might not know this, but url_for already takes an object, like
Merb's #resource.
Making Rails have identical defaults to Merb was never really on the table,
but making Rails flexible enough so you could swap out its defaults for what
you want in just a few lines of code certainly is.
As Jonas said, I'd consider Warden and Devise the natural successor of
merb-auth. I like them both very much (as well as their authors, Daniel
Neighman and José Valim).
Yehuda Katz
Developer | Engine Yard
(ph) 718.877.1325
On Mon, Apr 5, 2010 at 4:20 AM, Sean Kellogg <[email protected]>wrote:
> This is certainly an attractive idea to me and likely to my employer.
> Converting over to rails3 is "on the agenda" but if we could do that work
> without having to actually port a ton of code, that would be a big win for
> us.
>
> In addition to the items mentioned, I'd be curious as to what sort of
> challenges we might expect in rewiring merb-auth, which is something of a
> beast. I had made a mental note to switch over to authlogic when we ported
> to rail3, but maybe that won't be necessary?
>
> -Sean
>
> On Sunday 04 April 2010 4:39:22 pm Jacques Crocker wrote:
> > I agree, however I do think Rails3 is flexible enough to be able to
> > add these features back on. Creating a merb style controller in Rails3
> > would be very cool so that whatever the the actions returns gets
> > processed merb style. So if you return a string, a string gets
> > rendered. I think this would be pretty trivial to implement on top of
> > ActionController. I talked to Yehuda at mnt west about duplicating the
> > url() helper from merb, and it looks like its very near possible as is
> > (I think he mentioned it might need a small tweak in rails-core).
> >
> > Rails3 I think is a huge step in the right direction of modularity,
> > and I think will establish a huge community and platform around it. It
> > still has some of the old "cruft" from Rails2, however those things
> > should be able to be overridden and made better I think using some of
> > the really cool techniques that came out of Merb.
> >
> > I wonder, what if "Merb 2.0" used rails3 at its core and allowed any
> > existing merb app to run on top of it? And we could then make future
> > extensions while reusing the community and lots of existing code built
> > for Rails3.
> >
> > Not sure how many current Merb developers would be interested in
> > something like that, but if anyone wants to help out, I'd be willing
> > to contribute to an effort to try to get something like that up and
> > running.
> >
> > On Apr 4, 4:22 pm, JAZ <[email protected]> wrote:
> > > I wonder what is the future for Merb after Rails 3.0 final version
> > > will be released? Will it be continued as indepenedent Merb 2
> > > project? It might be quite possible...
> > >
> > > Although Rails 3 is apparently improved over Rails 2, it still uses a
> > > lot of crappy features of Rails 2.
> > >
> > > E.g. named route helpers. In Merb I can just write:
> > >
> > > %w(search read faq).map{|menu| url(menu)}
> > >
> > > In Rails 3 I have to write nasty:
> > >
> > > %w(search read faq).map{|menu| eval("#{menu|_url")}
> > >
> > > or even more verbose:
> > >
> > > %w(search read faq).map{|menu| link_to(menu, url_for(menu.to_sym))}
> > >
> > > Another example - rendering. I do not know why Rails 3 borrows from
> > > Rails2 magic render() method with its stupid DoubleRenderException
> > > error...
> > >
> > > --
> > > JZ
> >
> >
>
> --
> Sean Kellogg
> e: [email protected]
> w: http://blog.probonogeek.org
>
> --
> You received this message because you are subscribed to the Google Groups
> "merb" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected] <merb%[email protected]>.
> For more options, visit this group at
> http://groups.google.com/group/merb?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"merb" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/merb?hl=en.