Ruby render :action => “new” does not call new method…

… Even though I should know that It drove me crazy the last hour. It’s important to remember when using render in error handling with nested resources. The following actually does not work, since when calling render :action => “new” in the error handling, @b will not be set, an therefore render will fail (probably unless @b is not used at all)

https://gist.github.com/661956.js

It’s important to actually set @b in this case even though it is not actually needed for the create

https://gist.github.com/661962.js

Just nice to know, because it actually feels like calling a controller but it doesn’t.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.