All,
I have generated following model & controller
class Contact < ActiveRecord::Base
set_table_name "contact"
set_primary_key "contact_id"
end
class ContactController < ApplicationController
def index
list
render :action => 'list'
end
def contact
end
def list
@contact_pages, @contacts = paginate :contact, :per_page => 10
end
def show
@contact = Contact.find(params[:id])
end
def new
@contact = Contact.new
end
def create
@contact = Contact.new(params[:contact])
if @contact.save
flash[:notice] = 'Contact was successfully created.'
redirect_to :action => 'list'
else
render :action => 'new'
end
end
def edit
@contact = Contact.find(params[:id])
end
def update
@contact = Contact.find(params[:id])
if @contact.update_attributes(params[:contact])
flash[:notice] = 'Contact was successfully updated.'
redirect_to :action => 'show', :id => @contact
else
render :action => 'edit'
end
end
def destroy
Contact.find(params[:id]).destroy
redirect_to :action => 'list'
end
end
But when I attempted to generated the scaffold using script/generate scaffold
contact, I get a blank _form.rhtml. It looks like the following:
<%= error_messages_for 'contact' %>
<!--[form:contact]-->
<!--[eoform:contact]-->
But with the following model/controller it works fine:
class Task < ActiveRecord::Base
set_table_name "tasks"
set_primary_key "task_id"
end
class TaskController < ApplicationController
def index
list
render :action => 'list'
end
def task
end
def list
@task_pages, @tasks = paginate :task, :per_page => 10
end
def show
@task = Task.find(params[:id])
end
def new
@task = Task.new
end
def create
@task = Task.new(params[:task])
if @task.save
flash[:notice] = 'Task was successfully created.'
redirect_to :action => 'list'
else
render :action => 'new'
end
end
def edit
@task = Task.find(params[:id])
end
def update
@task = Task.find(params[:id])
if @task.update_attributes(params[:task])
flash[:notice] = 'Task was successfully updated.'
redirect_to :action => 'show', :id => @task
else
render :action => 'edit'
end
end
def destroy
Task.find(params[:id]).destroy
redirect_to :action => 'list'
end
end
_form.rhtml
<%= error_messages_for 'task' %>
<!--[form:task]-->
<p><label for="task_task_due_date">Task due
date</label><br/>
<%= datetime_select 'task', 'task_due_date' %></p>
<p><label for="task_task_type">Task
type</label><br/>
<%= text_field 'task', 'task_type' %></p>
<p><label for="task_task_notes">Task
notes</label><br/>
<%= text_field 'task', 'task_notes' %></p>
<p><label for="task_task_performer">Task
performer</label><br/>
<%= text_field 'task', 'task_performer' %></p>
<p><label for="task_task_complete_date">Task complete
date</label><br/>
<%= datetime_select 'task', 'task_complete_date'
%></p>
<p><label for="task_task_source">Task
source</label><br/>
<%= text_field 'task', 'task_source' %></p>
<p><label for="task_task_reschedule_date">Task reschedule
date</label><br/>
<%= datetime_select 'task', 'task_reschedule_date'
%></p>
<p><label for="task_last_modified_date">Last modified
date</label><br/>
<%= datetime_select 'task', 'last_modified_date'
%></p>
<p><label for="task_last_modified_by">Last modified
by</label><br/>
<%= text_field 'task', 'last_modified_by' %></p>
<p><label for="task_complete_not_applicable">Complete not
applicable</label><br/>
<%= text_field 'task', 'complete_not_applicable'
%></p>
<!--[eoform:task]-->
Any thoughts?
Thanks in advance,
Ron
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails