Ruby on Rails Saturday, September 1, 2012

On Saturday, September 1, 2012 11:05:36 PM UTC+1, Ruby-Forum.com User wrote:

===
Unknown action

The action 'dog' could not be found for StaticPagesController
===

Then if I add the dog action to the controller, then create a view,
everything works fine and dandy.


You can skip the adding an action bit and go straight to creating a view
 
But if I then delete the dog action, and then use the same url,
http://localhost:3000/static_pages/dog, in my browser, this time I get a
different result--instead of getting an error the view displays.  For
me,  that inconsistent behavior is not right, and it should not be that
way.   So I want to know whether there were reasons for the rails team
to institute that inconsistent behavior, or whether it is a bug.

This is a long standing rails feature (right back to 1.x at least): rails doesn't make you define an empty action. I don't think it's a feature that gets a whole lot of use, but it's definitely intentional (documented here: http://guides.rubyonrails.org/layouts_and_rendering.html#rendering-by-default-convention-over-configuration-in-action )

Fred
 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/E6utBi8UjJcJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment