Skip to content

Instantly share code, notes, and snippets.


Boris Kuznetsov achempion

Block or report user

Report or block achempion

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View internalization_helper.rb
module InternalizationHelper
# let's imagine that some methods defined in your model like 'title_en' and 'title_ru' for different locales
# helper will create 'title' method depending on current I18n.locale
# Model.rb
# extend InternalizationHelper
# define_translations_for 'title', 'description', ...
def define_translations_for *methods
methods.each do |method_name|
achempion / content_tag.js
Created Oct 14, 2012
Простой метод, позволяет создавать теги как с помощью рельсового метода `content_tag`
View content_tag.js
var content_tag;
content_tag = function(tag, content, params){
var tag, content, params, res;
var insert_params = '';
for(var key in params){
insert_params += ' '+key+'='+'"'+params[key]+'"';
res = '<'+tag+insert_params+'>'+content+'</'+tag+'>';
} else {
You can’t perform that action at this time.