Forum: Ruby on Rails Trying to use Ajax scaffold throws up odd behaviour

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
DJ Tequila (Guest)
on 2006-06-02 15:20
(Received via mailing list)
|Interesting... On a new project with a fresh database just created, I downloaded the 
smooth-loking Ajax Scaffold generator and tried it out on a 'pages' table:

C:\radrails\project>ruby script\generate ajax_scaffold Page PageAdmin
(I'm using Windows.)

After it calmed down I tried to access my shiny new admin page, but I
got this:|


  -----


  NameError in Page_admin#list

Showing /app/views/page_admin/list.rhtml/ where line *#1* raised:

|"::PageAdminController" is not a valid constant name!|

Extracted source (around line *#1*):

|1: <%= render_component :controller => '/page_admin', :action => 'component', :params => 
params %>|

|RAILS_ROOT: ./script/../config/..
|

|-----
|

|Obviously I removed the offending '/' before page_admin, but why is it
there? I've seen it before in generated code... Have I got some set-up
wrong somewhere? Has anyone else seen it or anything like it?
|

|Also, even with this fixed, adding a row or editing a row just leaves
the Ajax spinner spinning, even though the returned code works if I call
the Ajax'd page direct. (And I have Javascript enabled!)
|

|Has anyone had success with this generator or should I just give up and
go back to less flashy but less error-prone admin sites?
|

|On a related problem, has anyone else noticed the generator destroy
script removing vital view, model, test, etc. direcrtories? Or even
routes.rb? (The latter makes EVERYTHING fail thereafter until replaced,
generators fail without comment...)
|

|Is this normal?
|
This topic is locked and can not be replied to.