0

I have already a model in my Ruby on Rails aplication. I want to generate the Controller and Views.

Using the scaffold_controller option i get the files but the forms of the view dosnt contain the html input forms.

I can generate them using the parameters, for example

rails g scaffold_controller User name email

Is there some way to generate the html input tags without setting them as parameters? Can i make the scaffold_controller take the data from the existing model?

Thanks

RAJ
  • 9,697
  • 1
  • 33
  • 63
Cesar
  • 1,610
  • 2
  • 16
  • 42

1 Answers1

3

Actually, when you use scaffold_controller, you are telling generator not to consider model. If you want to consider model attribites, you will need to pass the required attributes, as you are doing.

For more clarity:

Stubs out a scaffolded controller and its views. Pass the model name, either CamelCased or under_scored, and a list of views as arguments. The controller name is retrieved as a pluralized version of the model name.

To create a controller within a module, specify the model name as a path like 'parent_module/controller_name'.

This generates a controller class in app/controllers and invokes helper, template engine and test framework generators.

Another related post

Community
  • 1
  • 1
RAJ
  • 9,697
  • 1
  • 33
  • 63