In my users_controller.rb I have:
def create
@user = User.new(params[:user])
respond_to do |format|
if @user.save
redirect_to @user, success: 'User was successfully created.'
else
flash.now[:error] = "There are some user signup errors"
format.html {render action: "new"}
end
end
end
In the views/user/_form.html.erb I have:
<% if !flash[:error].empty? %>
<div class="alert alert-error">
<p>There are some errors </p>
</div>
<% end %>
While running test I get: undefined method `empty?' for nil:NilClass I think that this view cannot see this variable, and not sure how should I pass it there.