Creative Rails English French

Problème jRails sortable_element

Attention si vous utilisez le plugin jRails qui permet d’avoir les helpers ajax en jQuery le sortable_element ne fonctionne pas.

Solution :

A la ligne 363 de jrails.rb dans le rép vendor/plugins… remplacer :
options[:with] ||= “#{JQUERY_VAR}(this).sortable(‘serialize’,{key:‘#{element_id}’})”

par :
options[:with] ||= “#{JQUERY_VAR}(this).sortable(‘serialize’,{key:‘#{element_id}[]’})”

sinon votre helper ne passera qu’un id et non pas un tableau.


Convertir ses fichiers erb en haml rapidement

Un petit script bien pratique pour les fans d’haml.

class ToHaml def initialize(path) @path = path end

def convert! Dir[“#{@path}//.erb”].each do |file| `html2haml -rx #{file} #{file.gsub(/\.erb$/, ‘.haml’)}` end end

end

path = File.join(File.dirname(FILE), ‘app’, ‘views’)
ToHaml.new(path).convert!

A placer dans un fichier à la racine du projet pour l’executer.


© Copyright 2009 Creative Rails Liens : Solisoft, AGSI