About views

Hi, everyone, I just want to know if I created a action in controller,
I must have need one view for this action?
except render :nothing=>true.

No, you don’t need a view for every action. Neither do you need an
action for every view.

If you want to see this in action, just create a resource will
scaffold_resource generator. index, show, new, edit all have views
while, create, update, and destroy do not. This is because the either
redirect to another view, or render another action.

Also, lets say you have a controller called main, and in the main
views folder, you had a file called index.rhtml. If the markup in
index.rhtml is all static, then you don’t even need an action for
index in the “main” controller.

Also, lets say you have a controller called main, and in the main
views folder, you had a file called index.rhtml. If the markup in
index.rhtml is all static, then you don’t even need an action for
index in the “main” controller.
This view doesn’t need to be static either. It could use variables
defined in before filters, methods in helpers, etc. Not a big deal, just
a little clarification.

-Bill

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs