This project is archived and is in readonly mode.
scaffold doesn't work correctly with modules
-
mgomez
Sorry, there is no preview in the ticketing system, I didn't mind to mess it up :-S
If you do scaffold with modules, the routes for the links inside views are not correctly generated.
Steps:
-
Write in the console:
script/generate scaffold -s module/klass name:string -
In your database:
CREATE TABLE klasses ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
INSERT INTO "klasses" ("name") VALUES ("foo")
- Go to http://localhost:3000/module/kla...
-
You get the following error:
undefined method `module_klasses_path' for # -
Check the source in config/routes.rb . Change
map.resources :klassesformap.resources :module_klasses -
Refresh your browser. You get the following error:
undefined local variable or method `klasses_path' for # -
Check the source in app/views/module/klasses/new.html.erb . Change
<%= link_to 'Back', klasses_path %>for<%= link_to 'Back', module_klasses_path %> - Refresh your browser. It shows correctly.
The process after step 7 can be repeated for the other views: edit, show, index, and corrected similarly.
-
Write in the console:
-
mgomez
Never mind, I didn't realize of the "Edit ticket" link on top of the page. Could any admin delete both comments?
-
Jorge Bernal
Here is a patch that seems to fix this. However, the resource generator suffers the same issue
-
Pratik
- State changed from new to wontfix
- Tag set to generators, patch, railties, routing
I get "Mysql::Error: Table 'project.users' doesn't exist: SELECT * FROM `users`" error when I tried "script/generate scaffold Admin::User"
