Add Sortable function, based on https://github.com/RubaXa/Sortable
A Pen by Florian LAMACHE on CodePen.
FROM debian:8.5 | |
## Image metadata ## | |
MAINTAINER Stuart Ellis, [email protected] | |
LABEL description="Rails Web application on Debian" | |
## Application user account ## | |
ENV APP_USER app |
Add Sortable function, based on https://github.com/RubaXa/Sortable
A Pen by Florian LAMACHE on CodePen.
class ActiveRecord::Base | |
class << self | |
def has_simple_search(*attrs) | |
raise 'has_simple_search expects at least one attribute' if attrs.empty? | |
instance_eval do # because this is ActiveRecord::Base, the class inherits this | |
class_attribute :simple_search_fields | |
self.simple_search_fields = attrs.flatten | |
def simple_search(search_string) | |
return find(:all) if search_string.nil? || search_string.blank? | |
attrs = self.simple_search_fields |
# Delete unnecessary files | |
run "rm public/index.html" | |
run "rm public/favicon.ico" | |
run "rm public/images/rails.png" | |
run "rm public/javascripts/prototype.js" | |
run "rm public/javascripts/effects.js" | |
run "rm public/javascripts/dragdrop.js" | |
run "rm public/javascripts/controls.js" | |
# Copy database.yml for distribution use |
require 'rubygems' | |
require 'mechanize' | |
user = 'xxxx' | |
pass = 'xxxx' | |
fini = false | |
a = WWW::Mechanize.new | |
page_post = a.post("http://#{user}.labrute.fr/login", 'pass' => pass) | |
@search = Ultrasphinx::Search.new(:query => get_query_by_subject(@subject.id), | |
:sort_mode => 'descending', | |
:sort_by => 'created_at', | |
:weights => {'titre' => 6.0, 'content' => 2.0}, | |
:page => params[:page] || 1) |