Ruby on Rails Sunday, June 5, 2016

> On Jun 5, 2016, at 7:35 PM, Rynn Steinbolt <lists@ruby-forum.com> wrote:
>
> Marco Antonio Almeida wrote in post #1183823:
>> Hi Rynn,
>>
>> On Mon, Jun 6, 2016 at 12:15 AM Rynn Steinbolt <lists@ruby-forum.com>
>> wrote:
>>
>>> The snippet in question is this one, it lives in an .html.erb file:
>>>
>>> var hour = [
>>> <% @raw.each do |raw| %>
>>> [ <%= if raw.status == "aufgewacht" %>
>>>
>>
>> It seems that your problem is here. You don't want to output the if
>> condition so you should actually have:
>>
>> <% if raw.status == "aufgewacht" %>
>
> Thank you! That does indeed get rid of the error messages. I wonder how
> i missed this.
> However, the code still doesnt work - there is no data displayed.
>
> Maybe the syntax highlighting makes it a bit clearer. Compare the two
> attached snippets, one with the js/erb code (with a working var hour
> below it, to demontrate that the js is (probably) not the problem, and
> some reguler embedded ruby without js.
>
> Attachments:
> http://www.ruby-forum.com/attachment/11367/Auswahl_004.jpg
> http://www.ruby-forum.com/attachment/11368/Auswahl_006.jpg
>
>

You may be getting tripped up by the fact that raw() is a view helper method, and you are using it within your block as a local variable. Try a different word, and see if that makes any difference.

Walter

> --
> 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+unsubscribe@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/1c77ef7500ca72a3d39fdfbaf4f3a2d3%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@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/B0BEAAAB-389F-4922-AD3B-49B77B50B787%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment