form_for not rendering

Paulo Carvalho
Wed, 09 May 2012 10:08:46 -0000

Hello

I am developing an application on rails using a couchDB database. I
already can connect to the database and view some information.
Now I am trying to create a new object of my model.

My model is named author. My controller is named authors.

The code of my model is the following one:

[code]
class Author < CouchRest::Model::Base

  timestamps!

  property :_id, String
  property :id, Integer
  property :title, String
  property :first_name, String
  property :last_name, String

  view_by :id,
          :map => "function(doc) {
            if(doc._id.indexOf(''Authors_'') == 0) {
              emit(null, doc);
            }
          }"
end
[/code]

The code of my controller is the following one:

[quote]
class AuthorsController < ApplicationController
  def list
    @authors = Author.by_id()
  end

  def new
    @author =Author.new
    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @author }
    end
  end

end


The code of my new.html.erb file is the following one:

[quote]
New author form

<% form_for @author do |f| %>

<%= f.label :title %>
<%= f.text_field :title %>


<%= f.label :first_name %>
<%= f.text_field :first_name %>

<%= f.label :last_name %>
<%= f.text_field :last_name %>


<%= f.submit :create %>


<% end %>

<%= link_to ''Back'', authors_path %>


The list method is working fine, it shows what I am expecting to.
However, the "new" html page does not shows anything except the title
and the "back" link. No error is generated. Everything is ok except
that
the form is not generated/displayed/rendered.
Does anyone have an idea about the problem/solution of it?
Thank you
Best regards

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org