DJ Tequila
2006-Jun-02 11:18 UTC
[Rails] Trying to use Ajax scaffold throws up odd behaviour
|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? |