On 1 September 2010 03:35, Ze Ca <[email protected]> wrote:
> hello!
>
> I made some custom validations for my app, which do catch invalid data
> in the console. However, when I enter invalid data through a form on the
> browser view, I get your stack trace error style page (similar to what
> you see when you get a syntax error or a nil object) instead of the
> nicely styled error messages (what you would see in a scaffolded
> application.
>
> First off, what is the stack trace error screen called in rails? And
> secondly, why can't I style the error?

Can you provide an example of what you mean?  If you are getting a
runtime Ruby error then you should never allow that to happen in your
code, so there is no need to style it.  If for example a variable may
be nil then you must test for nil before using it.  Perhaps I
misunderstand what you mean however.

Colin

>
> view code:
>
> <% form_for [...@post, Comment.new] do |f| %>
>
>  <p>
>    <%= f.label :title, "Your Comment" %><br />
>    <%= f.error_messages %>
>    <%= f.text_field :title %><br />
>  </p>
>  <%= f.submit "Submit Your Comment" %>
>
> controller code:
>
> class CommentsController < ApplicationController
>  def create
>     �...@post = Post.find(params[:post_id])
>     �...@comment = @post.comments.create!(params[:comment])
>      redirect_to @post
>  end
> end
>

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to