I have the following in the controller in Ruby on Rails:
def index
@categorias = Categoria.find(:all)
end
In my View I have the following code to get the categories:
<script type="text/javascript">
var teste = <%= @categorias %>;
alert(teste.length);
</script>
In this case, nothing is returned. Can anyone help me?