ID25 / rails_emoji_picker

Add emoji to your app :smiley_cat:
143 stars 41 forks source link

Emoji with action cable #15

Closed kortirso closed 6 years ago

kortirso commented 8 years ago

Good day. I send message block with action cable in rails 5 but message looks like 'message 😁'. How can I build correct block, transform 😁 into grin in model method?

RonanLOUARN commented 7 years ago

I found the solution.

Just put this gem helper methods in messages controller. http://textup.fr/184548YN

Has you can see i use method 'content_with_emoji(message.content)' in create method. And under private, all method are in gem helper... Just copy past all method under private except first ('message_params'), it's my params method.

if you want only gem helper: http://textup.fr/184541W8 But you have to patch line 68 (url = image_tag("emoji/#{img[:name]}.png")[/img.?src="(.?)"/i, 1]) to (url = ActionController::Base.helpers.image_tag("emoji/#{img[:name]}.png")[/img.?src="(.?)"/i, 1])) Sorry for my english.