Re: [Rails] how to pass data to javascript in div.content_tag

2020-01-07 Thread fugee ohu
On Sunday, January 5, 2020 at 8:41:33 AM UTC-5, Ariel Juodziukynas wrote: > > No, the first line is ruby and the convention is snakecase so it's ok you > use underscores, the second line is html and the attributes syntax is > hyphen, when you access that data attribute with javascript it will

Re: [Rails] how to pass data to javascript in div.content_tag

2020-01-05 Thread Ariel Juodziukynas
data attributes (data-something on an html tag) are accessed using the "dataset" property of javascript's HTMLElement element https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/dataset , that "received(data)" sounds like a callback from a promise or ajax call to me, that's a

Re: [Rails] how to pass data to javascript in div.content_tag

2020-01-05 Thread fugee ohu
On Sunday, January 5, 2020 at 8:41:33 AM UTC-5, Ariel Juodziukynas wrote: > > No, the first line is ruby and the convention is snakecase so it's ok you > use underscores, the second line is html and the attributes syntax is > hyphen, when you access that data attribute with javascript it will

Re: [Rails] how to pass data to javascript in div.content_tag

2020-01-05 Thread fugee ohu
On Sunday, January 5, 2020 at 8:41:33 AM UTC-5, Ariel Juodziukynas wrote: > > No, the first line is ruby and the convention is snakecase so it's ok you > use underscores, the second line is html and the attributes syntax is > hyphen, when you access that data attribute with javascript it will

Re: [Rails] how to pass data to javascript in div.content_tag

2020-01-05 Thread fugee ohu
On Sunday, January 5, 2020 at 8:41:33 AM UTC-5, Ariel Juodziukynas wrote: > > No, the first line is ruby and the convention is snakecase so it's ok you > use underscores, the second line is html and the attributes syntax is > hyphen, when you access that data attribute with javascript it will

Re: [Rails] how to pass data to javascript in div.content_tag

2020-01-05 Thread Ariel Juodziukynas
No, the first line is ruby and the convention is snakecase so it's ok you use underscores, the second line is html and the attributes syntax is hyphen, when you access that data attribute with javascript it will be dataset.conversationWithId as camelcase. You should write using the convention of

[Rails] how to pass data to javascript in div.content_tag

2020-01-04 Thread fugee ohu
<%= content_tag :div, id: "message_holder", data: {conversation_with_id: @conversation_with.id} do %> translates to this html from page source: The underscores get translated to hyphens Should I just rename the variable to conversation-with-id ? -- You received this message because you are