i'm not sure what you mean by styled. json usually looks like this
{user:{name:'fred',age:65}}. what kind of styling did you want to apply to
that?  i'm guessing, but it sounds like you're looking for html elements to
be returned?

typically after the request happens you can just use jquery's .html()
method to insert your json into the element:

$('.element').html(json-data-returned-from-server)  where .element is the
class name used by the html tag you're trying to insert your json.

json is just a string so it's will be hard to add styling other than a font
size, and font color.




On Mon, Jun 10, 2013 at 10:26 AM, Fernando Jesus <li...@ruby-forum.com>wrote:

> Ok i found the solution:
>
> http://stackoverflow.com/questions/7195473/rails-3-why-is-my-postshow-view-showing-all-of-its-comments-database-data-in
>
>
> The problem is in the view perhaps you have  =
>
>
> it's the = in the @comments.each tag. It is returning the result of
> each, which is the whole array.
>
> For example:
>
> irb> [1,2].each {|i| puts i }
> 1
> 2
> => [1, 2]
> So:
>
> <%= @comments.each do |comment| %>
> Should simply be:
>
> <% @comments.each do |comment| %>
>
>
> I hope that works for you.
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> 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 rubyonrails-talk+unsubscr...@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/9f326cb7ff13278486419abc3331df81%40ruby-forum.com?hl=en-US
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAE%2BzMv8aauvb%2B_L3L4nXN2COSPYNRuGPNxEOR9-ZWv%3DCB%2BvpyQ%40mail.gmail.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to