El Monday 26 January 2009 11:29:00 robby_rails escribió: > Ok here is exactly what I have done.. set for step > > > I create a new project: > rails image -d mysql > > I then go in and set my database file to access mysql (this part is > fine) I have a simple database called imagedb with a table called > image and 2 x fields > > The next thing I do is create a model > > ./generate model user id:int name:user --> No problems here
It's wrong, you will get a wrong migration, int and user aren't types, you don't need to put id in generate or migrations, is added automatically. > > I then create a controller > > ./generate controller user index list show --> No problems here It should be called "users" > > Right all fine . I test it by running the server and alls good. > > Next i get AS > /plugin install git://github.com/activescaffold/active_scaffold.git -r > rails-2.2 --> no problems here > > I return to my controller user_controller.rb and add the following > line to the top > class UserController < ApplicationController > active_scaffold :user > > I then edit the view\layout\user.html.erb to look like this > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> > <head> > <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> > <title>Generic ActiveScaffold Layout</title> > <%= javascript_include_tag :defaults %> > <%= active_scaffold_includes %> > </head> > <body> > > <%= yield %> > > </body> > </html> > > > I now go into the views\user directory and remove any *.html.erb files You should remove index, list and show methods in UserController, you are overriding active_scaffold methods. It will fix the problems, but to follow the conventions you should fix your controller name. Is easier to use script/generate resource <model_name> <column>:<type> ..., you don't need to remove views or methods, and the route is added, you only need to add :active_scaffold => true to the route. > > I then edit my routes.rb file with the following > map.resources :user, :active_scaffold => true If you call controller Users (you should), it should be map.resources :users, :active_scaffold => true > > Start up the server and go to http://127.0.0.1:3000/user/ > > I get the following > > Template is missing > > Missing template user/index.erb in view path /home/robby/rails/image/ > app/views:/home/robby/rails/image/vendor/plugins/active_scaffold/ > frontends/default/views: > > > I am lost I have followed everything I can think of. What am I doing > wrong. Before rails 2 it was so easy , now I cant get it to work. > Looks to me like rails is looking for a *.html.erb file and AS > has .rhtml files > > Any idea's as to what I am missing > > > > > > > > > > > > > > > > > > > > > > > -- Sergio Cambra .:: entreCables S.L. ::. Nicolás Guillén 6, locales 2 y 3. 50.018 Zaragoza T) 902 021 404 F) 976 52 98 07 E) [email protected] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/activescaffold?hl=en -~----------~----~----~----~------~----~------~--~---
