In Rails 3, you will be able to:

   - Use Merb code directly using a plugin (as a transition)
   - Use a Rails version of the API you showed

The Rails version of the API looks like this:

class CatsController < ApplicationController
  respond_to :xml, :yaml, :js

def new
   @cat = Cat.new
   respond_with @cat, :to => :html
 end

 def index
   @cats = Cat.all
   respond_with @cats
 end

 def show(id)
   @cat = Cat.get(id)
   raise NotFound unless @cat
   respond_with @cat
 end
end

Hope that clears it up :)

-- Yehuda

On Wed, Jul 22, 2009 at 12:47 AM, Durlabh <[email protected]> wrote:

>
> I am confused with this and would like to have an answer on this from
> the experts here...
>
> I am aware than Merb 2 would be Rails 3...but still i am not clear on
> few things.
>
> Pl. help me here...
>
> This is a Merb code which i like a lot...
>
> class Cats < Application
>  # provides :xml, :yaml, :js
>
> def new
>    only_provides :html
>    @cat = Cat.new
>    display @cat
>  end
>
>  def index
>    @cats = Cat.all
>    display @cats
>  end
>
>  def show(id)
>    @cat = Cat.get(id)
>    raise NotFound unless @cat
>    display @cat
>  end
>
> etc..............................>
>
> This is a Rails 2.x code, which i don't like much...
>
> def new
>  @post = Post.new
>
>  respond_to do |format|
>    format.html # new.html.erb
>    format.xml  { render :xml => @post }
>  end
> end
>
> etc....................................>
>
> My question is based on Rails 3.....
>
> My Question is can i use such type of MERB code in Rails 3 also. OR...
> It will be have to be of Rails 2.x type code only
>
> Its nice that currently my MERB code will get converted to Rails 3,
> but what will happen if i want to convert my current MERB code to
> Rails 3.x in future...?
>
> Pl. send me an email on durlabh.shah (at) gmail (dot) com, if you are
> not clear with my question...
>
> I would be very happy to get my query solved.
>
> Thanks
>
> Durlabh Shah
>
> P.S.:- Online Merb is not updated so far...
> >
>


-- 
Yehuda Katz
Developer | Engine Yard
(ph) 718.877.1325

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to