Re: [Rails] activestorage user.avatar.attached? in javascript

2020-01-28 Thread Ariel Juodziukynas
In your case, you CAN'T call "user.avatar.attached?" inside app/javascript/channels/room_channel.js.erb because it's a request dependant object. El mar., 28 ene. 2020 a las 12:24, Ariel Juodziukynas () escribió: > Although you can use .js.erb extension for any .js file you have to > understand

Re: [Rails] activestorage user.avatar.attached? in javascript

2020-01-28 Thread Ariel Juodziukynas
Although you can use .js.erb extension for any .js file you have to understand WHEN that erb gets executed to understand what you can do with it. Assets with .erb extension are compiled to JS code during the assets precompilation process, you can't put request dependant code (current_user,

Re: [Rails] activestorage user.avatar.attached? in javascript

2020-01-28 Thread fugee ohu
On Monday, January 27, 2020 at 8:28:48 AM UTC-5, Ariel Juodziukynas wrote: > > You can't, you need the .erb extension to execute ruby code. > > El lun., 27 ene. 2020 a las 0:29, fugee ohu ( >) escribió: > >> How would I run this same test in javascript without renaming my >> room_channel.js to

Re: [Rails] activestorage user.avatar.attached? in javascript

2020-01-27 Thread Ariel Juodziukynas
You can't, you need the .erb extension to execute ruby code. El lun., 27 ene. 2020 a las 0:29, fugee ohu () escribió: > How would I run this same test in javascript without renaming my > room_channel.js to room_channel.js.erb ? > > -- > You received this message because you are subscribed to the

[Rails] activestorage user.avatar.attached? in javascript

2020-01-26 Thread fugee ohu
How would I run this same test in javascript without renaming my room_channel.js to room_channel.js.erb ? -- 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