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
class ApplicationController < ActionController::Base | |
before_filter :prepend_view_path_if_mobile | |
def mobile_request? | |
@mobile_request ||= (request.subdomains.first == domain_prefixes[:mobile]) | |
end | |
helper_method :mobile_request? | |
def prepend_view_path_if_mobile | |
prepend_view_path Rails.root + 'app' + 'views_mobile' if mobile_request? |
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
-- http://www.postgresql.org/message-id/bddc86150908200534p14723ac2vd1ef223af095d822@mail.gmail.com | |
CREATE OR REPLACE FUNCTION | |
random_text(INTEGER) | |
RETURNS TEXT | |
LANGUAGE SQL | |
AS $$ | |
SELECT array_to_string(array( | |
SELECT SUBSTRING('23456789abcdefghjkmnpqrstuvwxyz' | |
FROM floor(random()*31)::int+1 FOR 1) |
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
module ActiveAdmin | |
module Reports | |
module DSL | |
def enable_reports | |
action_item only: :index do | |
link_to("Download", {action: :report, params: params}, {method: :post, data: { confirm: "Are you sure you want to generate this report?"}}) | |
end | |
collection_action :report, method: :post do |
OlderNewer