Ruby on Rails Friday, February 10, 2017

On 10 February 2017 at 14:29, 'krfg' via Ruby on Rails: Talk
<> wrote:
> ...
> Then the problem was just rendering the home page after invalid submission
> instead of redirecting to the home page.
> The original code was render 'static_pages/home', you can check it here.
> This original code would show a flash error message that the test would
> catch with:
> assert_select 'div#error_explanation'
> If I remove or comment this line in the test, the test would pass as long as
> I use a redirect in the create action of the microposts controller.
> No flash errors are showed after redirection, though

That is because the static_pages controller knows nothing about the
error. If you want to get that into the static_pages controller you
will have to do something like (untested)

redirect_to 'static_pages/home', :flash => { :error =>
@micropost.errors.full_messages.join(', ')}


You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment