This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a dirty hack to fix Draper problem with kaminari | |
# Put this in app/decorators/collection_decorator.rb | |
class Draper::CollectionDecorator | |
delegate :current_page, :total_pages, :limit_value | |
def total_count | |
source.total_count | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/active_admin.rb | |
ActiveAdmin.setup do |config| | |
config.current_user_method = :current_user | |
config.authentication_method = :authenticate_user! | |
config.before_filter :admin_role_filter | |
end | |
# Adding all recource names to Permissions table after ActiveAdmin is loaded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in any ActiveAdmin Resource you need in form block add the following code | |
# change 'translations' with your association name | |
f.has_many :translations do |translation| | |
translation.inputs("Caption"){} # Adding caption for languages | |
translation.inputs(""){} # Spacer | |
translations.input # add necessary inputs here | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if f.object.errors.size > 0 | |
f.inputs I18n.t("active_admin.errors") do | |
content_tag(:li, f.object.errors.full_messages.join('<br/>').html_safe, class: 'errors_messages') | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filter :reception_reception_date, as: :date_range, label: Reception.human_attribute_name(:reception_date_full) | |
collection_action :download_report, :method => :get do | |
services = Service.includes(:order, reception: [{medic: :clinic_medics}]).where{ orders.orderable_id != nil } # necessary model | |
if params[:q] && params[:q][:reception_reception_date_gte].length > 1 | |
services = services.where("receptions.reception_date >= ?", params[:q][:reception_reception_date_gte]) | |
end | |
if params[:q] && params[:q][:reception_reception_date_lte].length > 1 | |
services = services.where("receptions.reception_date < ?", params[:q][:reception_reception_date_lte]) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hack for using proxy on MacOS X | |
export http_proxy="http://LOGIN:PASSWORD@ADDRESS:PORT" | |
export ftp_proxy="http://LOGIN:PASSWORD@ADDRESS:PORT" | |
export FTP_PROXY="http://LOGIN:PASSWORD@ADDRESS:PORT" | |
export HTTP_PROXY="http://LOGIN:PASSWORD@ADDRESS:PORT" | |
export ALL_PROXY="http://LOGIN:PASSWORD@ADDRESS:PORT" | |
# Aliases | |
alias curl="curl -x LOGIN:PASSWORD@ADDRESS:PORT" | |
alias svn=colorsvn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For windows only. | |
# | |
csv_string = CSV.generate(col_sep: ";", encoding: 'Windows-1251') do |csv| | |
csv << "Add some data" | |
end | |
send_data(csv_string.encode('Windows-1251'), type: 'text/csv; charset=windows-1251; header=present', disposition: "attachment", filename: "file_to_export.csv") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#root { scroll-spy data-top-buffer="200" } | |
div spy="profile_info_part" | |
| Spy on profile info part and add 'active'class to this div | |
div | |
a name="profile_info_part" id="profile_info_part" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias 'pg_sql_restore'='PGPASSWORD=SOMEPASSWORD psql -cO -U username -d dbname -h localhost -f ' # + set path to backup file | |
alias 'pg_tar_restore'='PGPASSWORD=SOMEPASSWORD pg_restore -cO -U username -d dbname -h localhost ' # + set path to backup file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mina/bundler' | |
require 'mina/git' | |
set :application, "forum" | |
set :domain, '%SERVERNAME%' | |
set :deploy_to, "%PATH-TO-APPLICATION%" | |
set :repository, '%REPOSITORY-URL%.git' | |
set :branch, 'master' | |
set :login, "%LOGIN%" |
OlderNewer