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

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.