form_for not rendering

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
[/quote]

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

[quote]
<h1>New author form</h1>

<% form_for @author do |f| %>
  <div class="field">
    <p><%= f.label :title %>
    <%= f.text_field :title %></p>
  </div>

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

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

    <div class="action">
      <p><%= f.submit :create %></p>
    </div>

<% end %>

<%= link_to 'Back', authors_path %>
[/quote]

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

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
[/quote]

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

[quote]
<h1>New author form</h1>

<% form_for @author do |f| %>

Try <%= form_for ...

If that still does not work have a look at the html of the page (View

Page Source or similar in your browser) and see if there is any html

at all for the form.

Colin

Thanks a lot for your help.

This little "=" was missing and I was not able to see it.

Best regards.

Colin Law wrote in post #1060124: