Stock runner generated as:

-- cut here --
class Runners < Application
  # provides :xml, :yaml, :js

  # GET /runners
  def index
    @runners = Runner.find(:all)
    display @runners
  end

  # GET /runners/:id
  def show
    @runner = Runner.find_by_id(params[:id])
    raise NotFound unless @runner
    display @runner
  end

  # GET /runners/new
  def new
    only_provides :html
    @runner = Runner.new(params[:runner])
    render
  end

  # POST /runners
  def create
    @runner = Runner.new(params[:runner])
    if @runner.save
      redirect url(:runner, @runner)
    else
      render :new
    end
  end

  # GET /runners/:id/edit
  def edit
    only_provides :html
    @runner = Runner.find_by_id(params[:id])
    raise NotFound unless @runner
    render
  end

  # PUT /runners/:id
  def update
    @runner = Runner.find_by_id(params[:id])
    raise NotFound unless @runner
    if @runner.update_attributes(params[:runner])
      redirect url(:runner, @runner)
    else
      raise BadRequest
    end
  end

  # DELETE /runners/:id
  def destroy
    @runner = Runner.find_by_id(params[:id])
    raise NotFound unless @runner
    if @runner.destroy
      redirect url(:runners)
    else
      raise BadRequest
    end
  end

end
-- cut here --

-Arun
On Nov 17, 11:10 am, "Matt Aimonetti" <[EMAIL PROTECTED]> wrote:
> can you show us your controller, I won't what is @runner, in theory it
> should be an instance of your Runner class.
>
> -Matt
>
> On Mon, Nov 17, 2008 at 2:00 PM, Arun <[EMAIL PROTECTED]> wrote:
>
> > Added a simple new view as described at:
>
> >http://wiki.merbivore.com/howto/simple_new_view
>
> > The code looks like:
>
> > -- cut here --
> > <%= form_for(@runner, :action => resource(:runners) ) do %>
>
> >  <p>
> >    <%= text_field :distance, :label => "Distance" %>
> >  </p>
>
> >  <p>
> >    <%= text_field :minutes, :label => "Minutes"  %>
> >  </p>
>
> >  <p>
> >    <%= submit "Create" %>
> >  </p>
> > <% end =%>
>
> > <%= link_to 'Back', resource(:runners) %>
> > -- cut here --
>
> > Also added an entry:
>
> > resources :runners
>
> > in config/router.rb
>
> > Still getting the following error:
>
> > -- cut here --
> >  No Method Error 500
> > undefined method `form_for' for #<Runners:0x197a120>
>
> > All App Framework Gem Other
>
> >        app/views/runners/new.html.erb (ERB Template)   5
>
> > 1<h1>Runners controller, new action</h1> 2 3<p>Edit this file in
> > <tt>app/views/runners/new.html.erb</tt></p> 4 5<%= form_for
> > (@runner, :action => resource(:runners) ) do %> 6 7 <p> 8 <%=
> > text_field :distance, :label => "Distance" %> 9 </p> 10
> > -- cut here --
>
> > What's missing ?
>
> > -Arun
>
> > On Nov 12, 9:27 pm, Arun <[EMAIL PROTECTED]> wrote:
> > > The generated [index,new,show,edit].html.erb do not seem to have any
> > > code in there.
>
> > > How can I ensure that the right set of code is generated as well ?
>
> > > -Arun
>
> > > On Nov 12, 2:47 pm, "Matt Aimonetti" <[EMAIL PROTECTED]> wrote:
>
> > > > not sure, but merb-gen arguments are comma delimited and without space
> > > > (yeah, I know it sucks :()
>
> > > > try:
>
> > > > jruby -S merb-gen model --orm activerecord Runner
> > > > distance:float,minutes:integer
>
> > > > and
>
> > > > jruby -S merb-gen model Runner distance:float,minutes:integer
>
> > > > -Matt
>
> > > > On Wed, Nov 12, 2008 at 3:42 PM, Arun <[EMAIL PROTECTED]> wrote:
>
> > > > > jruby -S merb-gen model --orm activerecord Runner distance:float
> > > > > minutes:integer
>
> > > > > still showing the same error message.
>
> > > > > Any idea ?
>
> > > > > On Nov 12, 2:26 pm, Arun <[EMAIL PROTECTED]> wrote:
> > > > > > > merb-gen resource Bird name:string color:string family_id:integer
> > > > > > > last_location:string last_seen_at:datetime
>
> > > > > > "merb-gen resource" gives the error:
>
> > > > > >  FATAL: The file dm-core was not found
>
> > > > > > config/database.yml specify:
>
> > > > > > use_orm :activerecord
>
> > > > > > > merb-gen AR template uses  the same syntax as Rails generator.
>
> > > > > > merb-gen does not seem to show any help on this. Can you expand
> > more
> > > > > > here ?
>
> > > > > > -Arun
>
> > > > > > > -Matt
>
> > > > > > > On Fri, Sep 26, 2008 at 1:16 AM, Michael Klishin <
>
> > > > > > > [EMAIL PROTECTED]> wrote:
>
> > > > > > > > 2008/9/26 MyMerb <[EMAIL PROTECTED]>:
> > > > > > > > > So far... I have not seen any tutorial on Scaffolding in
> > Merb.
>
> > > > > > > > run merb-gen without arguments to see generators available on
> > your
> > > > > system.
> > > > > > > > Additional gems may provide their own generators.
> > > > > > > > --
> > > > > > > > MK
--~--~---------~--~----~------------~-------~--~----~
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