Help with scaffolds

I have create a ruby application at http://wopmod.digitalcarnival.com
and have done all the database stuff and have even migrated tables and
now I have trioed creating the scaffolds for it but when I go to the
main scaffolds page for it, DigitalCarnival.com is for sale | HugeDomains I
get an application error(rails) message yet when I go to say
DigitalCarnival.com is for sale | HugeDomains it works, any ideas
as to why it doesnt work?

Hi Stuart,

Do you have an index method in your people_controller.rb? If so, does it
look something like this?

def index
list
render :action => ‘list’
end

The above method handles URLs that don’t specify any other method, such
as DigitalCarnival.com is for sale | HugeDomains.

Shauna

Shauna wrote:

Hi Stuart,

Do you have an index method in your people_controller.rb? If so, does it
look something like this?

def index
list
render :action => ‘list’
end

The above method handles URLs that don’t specify any other method, such
as DigitalCarnival.com is for sale | HugeDomains.

Shauna

This is my index:

class PeopleController < ApplicationController
def index
list
render :action => ‘list’
end

GETs should be safe (see

URIs, Addressability, and the use of HTTP GET and POST)
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :list }

def list
@person_pages, @people = paginate :people, :per_page => 10
end

def show
@person = Person.find(params[:id])
end

def new
@person = Person.new
end

def create
@person = Person.new(params[:person])
if @person.save
flash[:notice] = ‘Person was successfully created.’
redirect_to :action => ‘list’
else
render :action => ‘new’
end
end

def edit
@person = Person.find(params[:id])
end

def update
@person = Person.find(params[:id])
if @person.update_attributes(params[:person])
flash[:notice] = ‘Person was successfully updated.’
redirect_to :action => ‘show’, :id => @person
else
render :action => ‘edit’
end
end

def destroy
Person.find(params[:id]).destroy
redirect_to :action => ‘list’
end
end

Would it matter that I also have another scaffold called news. which is
also doing the same thing, and even when I go to
DigitalCarnival.com is for sale | HugeDomains I get the error. I dont
know whats going wrong!

Skeets wrote:

Stuart, …people/show and …people/list are also not being picked up.
could you have you over ridden the basic scaffold and only completed
one of the views (edit)?

I dont think so, all I did was ruby script/generate scaffold people

I know edit and new work if add the .rhtml extension

Stuart, how did you set up the scaffold? can you post the relevant
controller code and the command line script you used to generate the
scaffold?

i’m thinking that your rails application is getting lost because it
doesn’t have a reference to and index (linking to an index.rhtml view)
in the People class.

good luck.

Stuart, what does your list.rhtml file look like int he views
directory? verify the name is “list.rhtml”.

have you tried restarting webrick to see if it just isn’t seeing
changes you’ve made?

if list,.rhtml exist and is in the views directory, you may want to
test out the connection. delete everything in list.rhtml and type in

here

.

try to load the page again and see if “here” is displayed.

Stuart, …people/show and …people/list are also not being picked up.
could you have you over ridden the basic scaffold and only completed
one of the views (edit)?

I have restarted my webrick server with no luck and here is what is in
my list.rhtml file:

Listing people

<% for column in Person.content_columns %> <% end %>

<% for person in @people %>

<% for column in Person.content_columns %> <% end %> <% end %>
<%= column.human_name %>
<%=h person.send(column.name) %><%= link_to 'Show', :action => 'show', :id => person %> <%= link_to 'Edit', :action => 'edit', :id => person %> <%= link_to 'Destroy', { :action => 'destroy', :id => person }, :confirm => 'Are you sure?', :post => true %>

<%= link_to ‘Previous page’, { :page => @person_pages.current.previous }
if @person_pages.current.previous %>
<%= link_to ‘Next page’, { :page => @person_pages.current.next } if
@person_pages.current.next %>


<%= link_to ‘New person’, :action => ‘new’ %>

Should I post my table structure?

OK!!! I think I have found why it wont work, when I migrated the tables
only went into development yet my app environment is production! How can
I just put my tables in to all the other databases (test and
development) Im using mysql and have phpmyadmin!

Ill try all that now, ill post more soon.

Stuart Loxton wrote:

OK!!! I think I have found why it wont work, when I migrated the tables
only went into development yet my app environment is production! How can
I just put my tables in to all the other databases (test and
development) Im using mysql and have phpmyadmin!

Ok I have everything working now, Thank You all!