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
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.