How to use pg_search_scope with Mobility for translated attributes? - internationalization

how can i use pg_search_scope in combination with Mobility for translated attributes? Available languages are :de and :en. Searching for category names return empty results. There mus be a way to search for locale_accessors, in my case it should be name_de || name_en depending on current i18n.locale settings.
Here's my controller method:
def index
#categories = params[:query].present? ? Category.search(params[:query]) : Category.all.includes(%i[string_translations])
end
Here's my model:
class Category < ApplicationRecord
extend Mobility
translates :name, type: :string
include PgSearch::Model
pg_search_scope :search,
against: [:name],
using: {
trigram: { threshold: 0.3, word_similarity: true }
}
end
Here's my mobility config:
Mobility.configure do
# PLUGINS
plugins do
# Backend
#
# Sets the default backend to use in models. This can be overridden in models
# by passing +backend: ...+ to +translates+.
#
# To default to a different backend globally, replace +:key_value+ by another
# backend name.
#
backend :key_value
# ActiveRecord
#
# Defines ActiveRecord as ORM, and enables ActiveRecord-specific plugins.
active_record
# Accessors
#
# Define reader and writer methods for translated attributes. Remove either
# to disable globally, or pass +reader: false+ or +writer: false+ to
# +translates+ in any translated model.
#
reader
writer
# Backend Reader
#
# Defines reader to access the backend for any attribute, of the form
# +<attribute>_backend+.
#
backend_reader
#
# Or pass an interpolation string to define a different pattern:
# backend_reader "%s_translations"
# Query
#
# Defines a scope on the model class which allows querying on
# translated attributes. The default scope is named +i18n+, pass a different
# name as default to change the global default, or to +translates+ in any
# model to change it for that model alone.
#
query
# Cache
#
# Comment out to disable caching reads and writes.
#
cache
# Dirty
#
# Uncomment this line to include and enable globally:
# dirty
#
# Or uncomment this line to include but disable by default, and only enable
# per model by passing +dirty: true+ to +translates+.
# dirty false
# Fallbacks
#
# Uncomment line below to enable fallbacks, using +I18n.fallbacks+.
# fallbacks
#
# Or uncomment this line to enable fallbacks with a global default.
# fallbacks { :pt => :en }
# Presence
#
# Converts blank strings to nil on reads and writes. Comment out to
# disable.
#
presence
# Default
#
# Set a default translation per attributes. When enabled, passing +default:
# 'foo'+ sets a default translation string to show in case no translation is
# present. Can also be passed a proc.
#
# default 'foo'
# Fallthrough Accessors
#
# Uses method_missing to define locale-specific accessor methods like
# +title_en+, +title_en=+, +title_fr+, +title_fr=+ for each translated
# attribute. If you know what set of locales you want to support, it's
# generally better to use Locale Accessors (or both together) since
# +method_missing+ is very slow. (You can use both fallthrough and locale
# accessor plugins together without conflict.)
#
# fallthrough_accessors
# Locale Accessors
#
# Uses +def+ to define accessor methods for a set of locales. By default uses
# +I18n.available_locales+, but you can pass the set of locales with
# +translates+ and/or set a global default here.
#
locale_accessors
#
# Or define specific defaults by uncommenting line below
# locale_accessors [:en, :ja]
# Attribute Methods
#
# Adds translated attributes to +attributes+ hash, and defines methods
# +translated_attributes+ and +untranslated_attributes+ which return hashes
# with translated and untranslated attributes, respectively. Be aware that
# this plugin can create conflicts with other gems.
#
# attribute_methods
end
end
Is it possible and how it works?
Thank you very much for help me out in this case!

You can use dynamic scope with lambda and return the config hash with the query:
pg_search_scope :search, lambda { |query|
{
against: ["name_#{I18n.locale}".to_sym],
trigram: { threshold: 0.3, word_similarity: true },
ignoring: :accents,
query: query
}
}

Related

How can I dynamically call a Model using Mongoid when I only know the collection name?

lets say I have 20+ models, and one of them is called Job
module API
class Job
include Mongoid::Document
# ...
store_in collection: :jobs
# ...
end
end
Im working on some HTTP webhooks, and I am specifying what collection a system administrator will want to subscribe to updates for.
that said, I will know that the collection is called jobs
known_info = { db_name: 'x', collection: 'jobs', id: '6095d84c5be78a26cc9d837b' }
## this is the normally way one would query jobs, but I want to mimic it
## dynamically not using the Module name
API::Job.find(known_info[:id])
## a second way that will NOT work,
## this evades all API code that I have written, I need to use my ruby code in the
## model with access to the class functions
document = nil
Mongoid.default_client.collections.each do |collection|
next unless collection.namespace == "#{known_info[:db_name]}.#{known_info[:collection]}"
document = collection.find(_id: known_info[:id]).limit(1).first
end
## this will return the record from the database,
## but it will not send it through the model, its just the raw database value
pp document =>
{"_id"=>BSON::ObjectId('6095d84c5be78a26cc9d837b'),
...
}
I was able to figure it out by doing the following.
Using the namespace that the models are wrapped in, you can query the constants and narrow them down
known_info = { db_name: 'x', collection: 'jobs', id: '6095d84c5be78a26cc9d837b' }
document = nil
API.constants.each do |constant|
module_class = API.const_get(constant)
## skip of the constant is not a class
next unless module_class.is_a?(Class)
## skip if the class does not have a method called "collection_name"
next unless module_class.respond_to?(:collection_name)
## skip if the collection does not match the known collection
next unless module_class.collection_name.to_s == known_info[:collection]
document = module_class.find(known_info[:id])
end
p document
## success!

How to find out all classes of ruby corelib?

I need to return an Array of all classes that are part of ruby core.
http://ruby-doc.org/core-2.2.3/
For instance, the array should be like this:
[Array, String, Hash etc..]
Can also be strings instead such as:
['Array', 'String', 'Hash']
This should lateron be used for looking up documentation of ri, but prior to invoke ri - and it must only work for ruby core docu, deliberately not so for any other part of ruby (vanilla ruby is to be targeted for one project here, and the only constant to be usable is the default ruby install on the user's computer).
Thanks.
ObjectSpace.each_object(Class). # Get all instances of `Class`
reject {|klass| klass.name.nil? } # Reject singleton classes
# => [ARGF.class, ArgumentError, Array, BasicObject, Bignum, Binding, Class,
# Complex, Complex::compatible, Data, Dir, EOFError, Encoding,
# Encoding::CompatibilityError, Encoding::Converter,
# Encoding::ConverterNotFoundError, Encoding::InvalidByteSequenceError,
# Encoding::UndefinedConversionError, EncodingError, Enumerator,
# Enumerator::Generator, Enumerator::Lazy, Enumerator::Yielder, Errno::E2BIG,
# Errno::EACCES, Errno::EADDRINUSE, Errno::EADDRNOTAVAIL, Errno::EAFNOSUPPORT,
# Errno::EAGAIN, Errno::EALREADY, Errno::EAUTH, Errno::EBADF, Errno::EBADMSG,
# Errno::EBADRPC, Errno::EBUSY, Errno::ECANCELED, Errno::ECHILD,
# Errno::ECONNABORTED, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EDEADLK,
# Errno::EDESTADDRREQ, Errno::EDOM, Errno::EDQUOT, Errno::EEXIST,
# Errno::EFAULT, Errno::EFBIG, Errno::EFTYPE, Errno::EHOSTDOWN,
# Errno::EHOSTUNREACH, Errno::EIDRM, Errno::EILSEQ, Errno::EINPROGRESS,
# Errno::EINTR, Errno::EINVAL, Errno::EIO, Errno::EISCONN, Errno::EISDIR,
# Errno::ELOOP, Errno::EMFILE, Errno::EMLINK, Errno::EMSGSIZE,
# Errno::EMULTIHOP, Errno::ENAMETOOLONG, Errno::ENEEDAUTH, Errno::ENETDOWN,
# Errno::ENETRESET, Errno::ENETUNREACH, Errno::ENFILE, Errno::ENOATTR,
# Errno::ENOBUFS, Errno::ENODATA, Errno::ENODEV, Errno::ENOENT,
# Errno::ENOEXEC, Errno::ENOLCK, Errno::ENOLINK, Errno::ENOMEM, Errno::ENOMSG,
# Errno::ENOPROTOOPT, Errno::ENOSPC, Errno::ENOSR, Errno::ENOSTR,
# Errno::ENOSYS, Errno::ENOTBLK, Errno::ENOTCONN, Errno::ENOTDIR,
# Errno::ENOTEMPTY, Errno::ENOTRECOVERABLE, Errno::ENOTSOCK, Errno::ENOTSUP,
# Errno::ENOTTY, Errno::ENXIO, Errno::EOPNOTSUPP, Errno::EOVERFLOW,
# Errno::EOWNERDEAD, Errno::EPERM, Errno::EPFNOSUPPORT, Errno::EPIPE,
# Errno::EPROCLIM, Errno::EPROCUNAVAIL, Errno::EPROGMISMATCH,
# Errno::EPROGUNAVAIL, Errno::EPROTO, Errno::EPROTONOSUPPORT,
# Errno::EPROTOTYPE, Errno::ERANGE, Errno::EREMOTE, Errno::EROFS,
# Errno::ERPCMISMATCH, Errno::ESHUTDOWN, Errno::ESOCKTNOSUPPORT,
# Errno::ESPIPE, Errno::ESRCH, Errno::ESTALE, Errno::ETIME, Errno::ETIMEDOUT,
# Errno::ETOOMANYREFS, Errno::ETXTBSY, Errno::EUSERS, Errno::EXDEV,
# Errno::NOERROR, Exception, FalseClass, Fiber, FiberError, File, File::Stat,
# Fixnum, Float, FloatDomainError, Gem::BasicSpecification,
# Gem::CommandLineError, Gem::ConflictError, Gem::DependencyError,
# Gem::DependencyRemovalException, Gem::DependencyResolutionError,
# Gem::DocumentError, Gem::EndOfYAMLException, Gem::ErrorReason,
# Gem::Exception, Gem::FilePermissionError, Gem::FormatException,
# Gem::GemNotFoundException, Gem::GemNotInHomeException,
# Gem::ImpossibleDependenciesError, Gem::InstallError,
# Gem::InvalidSpecificationException, Gem::List, Gem::LoadError,
# Gem::OperationNotSupportedError, Gem::Platform, Gem::PlatformMismatch,
# Gem::RemoteError, Gem::RemoteInstallationCancelled,
# Gem::RemoteInstallationSkipped, Gem::RemoteSourceException, Gem::Requirement,
# Gem::Requirement::BadRequirementError, Gem::RubyVersionMismatch,
# Gem::SourceFetchProblem, Gem::SpecificGemNotFoundException,
# Gem::Specification, Gem::StubSpecification, Gem::StubSpecification::StubLine,
# Gem::SystemExitException, Gem::UnsatisfiableDependencyError,
# Gem::VerificationError, Gem::Version, Hash, IO, IO::EAGAINWaitReadable,
# IO::EAGAINWaitWritable, IO::EINPROGRESSWaitReadable,
# IO::EINPROGRESSWaitWritable, IOError, IndexError, Integer, Interrupt,
# KeyError, LoadError, LocalJumpError, MatchData, Math::DomainError, Method,
# Module, Monitor, MonitorMixin::ConditionVariable,
# MonitorMixin::ConditionVariable::Timeout, Mutex, NameError,
# NameError::message, NilClass, NoMemoryError, NoMethodError,
# NotImplementedError, Numeric, Object, ObjectSpace::WeakMap, Proc,
# Process::Status, Process::Tms, Process::Waiter, Random, Range, RangeError,
# Rational, Rational::compatible, Regexp, RegexpError, RubyVM, RubyVM::Env,
# RubyVM::InstructionSequence, RuntimeError, ScriptError, SecurityError,
# SignalException, StandardError, StopIteration, String, StringIO, Struct,
# Symbol, SyntaxError, SystemCallError, SystemExit, SystemStackError, Thread,
# Thread::Backtrace, Thread::Backtrace::Location, Thread::ConditionVariable,
# Thread::Queue, Thread::SizedQueue, ThreadError, ThreadGroup, Time,
# TracePoint, TrueClass, TypeError, UnboundMethod, UncaughtThrowError,
# ZeroDivisionError, fatal]
Note, however, that by artificially restricting yourself to classes, you miss out on some rather important methods which are defined in modules, for example Kernel#puts and Kernel#require.
I removed singleton classes from the list, because it would have become just too cluttered, but unfortunately, this means that you are now missing, for example, using, which is defined in the singleton class of the anonymous top-level object usually called main.
You also miss out on pre-defined values that are not classes or modules, such as Float::INFINITY, true, false, nil, etc.
Note also that this will return all classes loaded, not only those from the core library, but also implementation-specific classes. The whole RubyVM namespace, for example, is a private internal implementation detail of YARV and doesn't exist on other Ruby implementations. Likewise, Fixnum and Bignum are not guaranteed to exist, the Ruby Language Specification only guarantees that there is an Integer class which may or may not have zero or more implementation-specific subclasses.
A better approach to guaranteeing that your code runs on all Ruby implementations would be to restrict yourself to the language, modules and classes defined in the ISO Ruby Language Specification.

logstash filter encode character failed

we have a log in GB18030 charset, and we want to encode the log to UTF8 when it's shipped from logstash to elasticsearch. After read the document from logstash website, we found a filter could do this for us. I had never used RUBY before, I copied a logstash filter from logstash website and modified a little.
# Call this file 'foo.rb' (in logstash/filters, as above)
require "logstash/filters/base"
require "logstash/namespace"
require "logstash/environment"
class LogStash::Filters::Foo < LogStash::Filters::Base
# Setting the config_name here is required. This is how you
# configure this filter from your logstash config.
#
# filter {
# foo { ... }
# }
config_name "foo"
attr_accessor :logger
# New plugins should start life at milestone 1.
milestone 1
public
def register
# nothing to do
end # def register
public
def filter(event)
# return nothing unless there's an actual filter event
return unless filter?(event)
# Replace the event message with our message as configured in the
# config file.
a = event["message"].force_encoding("GB18030")
$stdout.write("\n origin:"+a+"\n")
$stdout.write("\n encoded:+ a.encode("UTF-8","GB18030")+"\n\n")
event["message"] = event["message"].encode("UTF-8","GB18030")
# filter_matched should go in the last line of our successful code
filter_matched(event)
end # def filter
end # class LogStash::Filters::Foo
Here's the screen output
origin:\xA1\xA2\xD3\xFE]\xCA\xFD\xBE\xDD\xD5\xFD\xD4\xD3\xCA\xFD\xBE\xE2\xBC\xD3
encoded:\xA1\xA2\xD3\xFE]\xCA\xFD\xBE\xDD\xD5\xFD\xD4\xD3\xCA\xFD\xBE\xE2\xBC\xD3
It seems the "encode" function didn't work. I tried encode the string above in RUBY2.1.5 interpreter, it works fine.

Where is the aspell private dictionary on Mac [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I am using emacs on Mac Os X and I installed aspell with homebrew. I accidentally added a wrong word to my "private dictionary", but where is that dictionary? How can I open it and see what I have added in there?
I found a similar question here (How to remove an entry from ispell private dictionary?) but I couldn't find the directories they mentioned. I found one aspell folder at \usr\local\Cellar\aspell\, but I still can't find which one is the private dictionary.
Search for a file ending in .pws -- it will probably look something like this .aspell.en.pws for English.
You can also run something like this to see where everything is located -- just change the path to wherever your own aspell executable is located:
/Users/HOME/.0.data/.0.emacs/elpa/bin/aspell --lang=en dump config
If you want to change things, you can create an aspell.conf and put it inside the etc folder, which should be in the same set of directories near to where the aspell executable is located. I actually had to create the etc folder and the aspell.conf because the make process of a generic installation did not create that folder. Running the above command-line will also tell you the location where aspell looks for the aspell.conf file.
Sample aspell.conf: I only use Spanish and English -- the default on my setup is the latter -- borrowed (and modified from): https://github.com/jone/dotfiles/blob/master/aspell.conf
# /Users/HOME/.0.data/.0.emacs/elpa/bin/aspell --lang=en dump config
# conf (string)
# main configuration file
# default: aspell.conf
# home-dir (string)
# location for personal files
# default: <$HOME|./> = /Users/jone
# home-dir $HOME/Library/Preferences/aspell
home-dir /Users/HOME/.0.data/.0.emacs
# personal (string)
# personal dictionary file name
# default: .aspell.<lang>.pws = .aspell.de_CH.pws
personal .aspell.en.pws
# conf-dir (string)
# location of main configuration file
# default: <prefix:etc> = /usr/local/etc
# data-dir (string)
# location of language data files
# default: <prefix:lib/aspell-0.60> = /usr/local/lib/aspell-0.60
# data-dir /usr/local/lib/aspell-0.60
# dict-alias (list)
# create dictionary aliases
# dict-dir (string)
# location of the main word list
# default: <data-dir> = /usr/local/lib/aspell-0.60
# dict-dir /usr/local/lib/aspell-0.60
# encoding (string)
# encoding to expect data to be in
# default: !encoding = UTF-8
# filter (list)
# add or removes a filter
# filter-path (list)
# path(s) aspell looks for filters
# mode (string)
# filter mode
# default: url
# mode tex
# extra-dicts (list)
# extra dictionaries to use
# ignore (integer)
# ignore words <= n chars
# default: 1
# ignore-case (boolean)
# ignore case when checking words
# default: false
# ignore-repl (boolean)
# ignore commands to store replacement pairs
# default: false
ignore-repl false
# keyboard (string)
# keyboard definition to use for typo analysis
# default: standard
# lang (string)
# language code
# default: <language-tag> = de_CH
# local-data-dir (string)
# location of local language data files
# default: <actual-dict-dir> = /usr/local/lib/aspell-0.60/
# master (string)
# base name of the main dictionary to use
# default: <lang> = de_CH
# normalize (boolean)
# enable Unicode normalization
# default: true
# norm-required (boolean)
# Unicode normalization required for current lang
# default: false
# norm-form (string)
# Unicode normalization form: none, nfd, nfc, comp
# default: nfc
# norm-strict (boolean)
# avoid lossy conversions when normalization
# default: false
# per-conf (string)
# personal configuration file
# default: .aspell.conf
# prefix (string)
# prefix directory
# default: /usr/local
# repl (string)
# replacements list file name
# default: .aspell.<lang>.prepl = .aspell.de_CH.prepl
# run-together (boolean)
# consider run-together words legal
# default: false
# run-together-limit (integer)
# maximum number that can be strung together
# default: 2
# run-together-min (integer)
# minimal length of interior words
# default: 3
# save-repl (boolean)
# save replacement pairs on save all
# default: true
# set-prefix (boolean)
# set the prefix based on executable location
# default: true
# size (string)
# size of the word list
# default: +60
# sug-mode (string)
# suggestion mode
# default: normal
# sug-edit-dist (integer)
# edit distance to use, override sug-mode default
# default: 1
# sug-typo-analysis (boolean)
# use typo analysis, override sug-mode default
# default: true
# sug-repl-table (boolean)
# use replacement tables, override sug-mode default
# default: true
# sug-split-char (list)
# characters to insert when a word is split
# use-other-dicts (boolean)
# use personal, replacement & session dictionaries
# default: true
# variety (list)
# extra information for the word list
# warn (boolean)
# enable warnings
# default: true
# affix-compress (boolean)
# use affix compression when creating dictionaries
# default: false
# clean-affixes (boolean)
# remove invalid affix flags
# default: true
# clean-words (boolean)
# attempts to clean words so that they are valid
# default: false
# invisible-soundslike (boolean)
# compute soundslike on demand rather than storing
# default: false
# partially-expand (boolean)
# partially expand affixes for better suggestions
# default: false
# skip-invalid-words (boolean)
# skip invalid words
# default: true
# validate-affixes (boolean)
# check if affix flags are valid
# default: true
# validate-words (boolean)
# check if words are valid
# default: true
# backup (boolean)
# create a backup file by appending ".bak"
# default: true
# byte-offsets (boolean)
# use byte offsets instead of character offsets
# default: false
# guess (boolean)
# create missing root/affix combinations
# default: false
# keymapping (string)
# keymapping for check mode: "aspell" or "ispell"
# default: aspell
# reverse (boolean)
# reverse the order of the suggest list
# default: false
# suggest (boolean)
# suggest possible replacements
# default: true
# time (boolean)
# time load time and suggest time in pipe mode
# default: false
#######################################################################
#
# Filter: context
# experimental filter for hiding delimited contexts
#
# configured as follows:
# f-context-delimiters (list)
# context delimiters (separated by spaces)
# f-context-visible-first (boolean)
# swaps visible and invisible text
# default: false
#######################################################################
#
# Filter: email
# filter for skipping quoted text in email messages
#
# configured as follows:
# f-email-quote (list)
# email quote characters
# f-email-margin (integer)
# num chars that can appear before the quote char
# default: 10
#######################################################################
#
# Filter: html
# filter for dealing with HTML documents
#
# configured as follows:
# f-html-check (list)
# HTML attributes to always check
# f-html-skip (list)
# HTML tags to always skip the contents of
#######################################################################
#
# Filter: sgml
# filter for dealing with generic SGML/XML documents
#
# configured as follows:
# f-sgml-check (list)
# SGML attributes to always check
# f-sgml-skip (list)
# SGML tags to always skip the contents of
#######################################################################
#
# Filter: tex
# filter for dealing with TeX/LaTeX documents
#
# configured as follows:
# f-tex-check-comments (boolean)
# check TeX comments
# default: false
# f-tex-command (list)
# TeX commands
#######################################################################
#
# Filter: texinfo
# filter for dealing with Texinfo documents
#
# configured as follows:
# f-texinfo-ignore (list)
# Texinfo commands to ignore the parameters of
# f-texinfo-ignore-env (list)
# Texinfo environments to ignore
These are my notes for installing aspell on Windows and OSX:
OSX -- To dump the aspell configuration in OSX type:
# /Users/HOME/.0.data/.0.emacs/elpa/bin/aspell --lang=en dump config
The aspell.conf goes into the .../etc directory
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
OSX -- ASPELL -- Binary
* unpack aspell-0.60.6.tar.gz
* cd over to the root directory of the unpacked source
PATH=/usr/bin:/usr/sbin:/bin:/sbin ./configure \
--prefix=$HOME/.0.data/.0.emacs/elpa
make
sudo make install
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
OSX -- ASPELL -- DICTIONARY -- English
* unpack aspell6-en-7.1-0.tar.bz2
* cd over to the root directory of the unpacked source
./configure \
--vars PATH=$PATH:/Users/HOME/.0.data/.0.emacs/elpa/bin
make
sudo make install
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
OSX -- ASPELL -- DICTIONARY -- Spanish
* unpack aspell6-es-1.11-2.tar.bz2
* cd over to the root directory of the unpacked source
./configure \
--vars PATH=$PATH:/Users/HOME/.0.data/.0.emacs/elpa/bin
make
sudo make install
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Windows XP -- install:
BASE: Aspell-0-50-3-3-Setup.exe
English: Aspell-en-0.50-2-3.exe
Spanish: Aspell-es-0.50-2-3.exe
Windows XP -- create an aspell.conf file at the following location:
c:/Program Files/Aspell/aspell.conf
# aspell.conf
# To dump the configuration, type into the terminal:
# "c:/Program Files/Aspell/bin/aspell.exe" --lang=en dump config
home-dir y:\.0.emacs
personal .aspell.en.pws
repl .aspell.en.prepl

can access active admin/users on local but not production

ok so I can get to active admin on local and my site just fine - within active admin I have the options to select from Pins or Users (my two models) on local, can see all of the pins and users in the db just fine. However, live (heroku) I can access active admin barnpix.com/admin and clicking on pins works just fine ..however when I click users I get a generic heroku error... please help why does this work in local but not live?
Omrails::Application.routes.draw do
get "pages/tagz"
get "pages/about"
get "posts/show"
get "posts/destroy"
root :to => 'pins#index'
get 'tags/:tag' , to: 'pins#index', as: :tag
get "posts", to: "posts#index"
resources :posts
resources :pins
get "users/show"
devise_for :users
match 'users/:id' => 'users#show', as: :user
ActiveAdmin.routes(self)
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
devise_for :views
ActiveAdmin.routes(self)
ActiveAdmin.setup do |config|
# == Site Title
#
# Set the title that is displayed on the main layout
# for each of the active admin pages.
#
config.site_title = "BarnPix.com"
# Set the link url for the title. For example, to take
# users to your main site. Defaults to no link.
#
config.site_title_link = "http://www.barnpix.com"
# Set an optional image to be displayed for the header
# instead of a string (overrides :site_title)
#
# Note: Recommended image height is 21px to properly fit in the header
#
# config.site_title_image = "/images/logo.png"
# == Default Namespace
#
# Set the default namespace each administration resource
# will be added to.
#
# eg:
# config.default_namespace = :hello_world
#
# This will create resources in the HelloWorld module and
# will namespace routes to /hello_world/*
#
# To set no namespace by default, use:
# config.default_namespace = false
#
# Default:
# config.default_namespace = :admin
#
# You can customize the settings for each namespace by using
# a namespace block. For example, to change the site title
# within a namespace:
#
# config.namespace :admin do |admin|
# admin.site_title = "Custom Admin Title"
# end
#
# This will ONLY change the title for the admin section. Other
# namespaces will continue to use the main "site_title" configuration.
# == User Authentication
#
# Active Admin will automatically call an authentication
# method in a before filter of all controller actions to
# ensure that there is a currently logged in admin user.
#
# This setting changes the method which Active Admin calls
# within the controller.
config.authentication_method = :authenticate_admin_user!
# == Current User
#
# Active Admin will associate actions with the current
# user performing them.
#
# This setting changes the method which Active Admin calls
# to return the currently logged in user.
config.current_user_method = :current_admin_user
# == Logging Out
#
# Active Admin displays a logout link on each screen. These
# settings configure the location and method used for the link.
#
# This setting changes the path where the link points to. If it's
# a string, the strings is used as the path. If it's a Symbol, we
# will call the method to return the path.
#
# Default:
config.logout_link_path = :destroy_admin_user_session_path
# This setting changes the http method used when rendering the
# link. For example :get, :delete, :put, etc..
#
# Default:
# config.logout_link_method = :get
# == Root
#
# Set the action to call for the root path. You can set different
# roots for each namespace.
#
# Default:
# config.root_to = 'dashboard#index'
# == Admin Comments
#
# Admin comments allow you to add comments to any model for admin use.
# Admin comments are enabled by default.
#
# Default:
# config.allow_comments = true
#
# You can turn them on and off for any given namespace by using a
# namespace config block.
#
# Eg:
# config.namespace :without_comments do |without_comments|
# without_comments.allow_comments = false
# end
# == Batch Actions
#
# Enable and disable Batch Actions
#
config.batch_actions = true
# == Controller Filters
#
# You can add before, after and around filters to all of your
# Active Admin resources and pages from here.
#
# config.before_filter :do_something_awesome
# == Register Stylesheets & Javascripts
#
# We recommend using the built in Active Admin layout and loading
# up your own stylesheets / javascripts to customize the look
# and feel.
#
# To load a stylesheet:
# config.register_stylesheet 'my_stylesheet.css'
# You can provide an options hash for more control, which is passed along to stylesheet_link_tag():
# config.register_stylesheet 'my_print_stylesheet.css', :media => :print
#
# To load a javascript file:
# config.register_javascript 'my_javascript.js'
# == CSV options
#
# Set the CSV builder separator (default is ",")
# config.csv_column_separator = ','
#
# Set the CSV builder options (default is {})
# config.csv_options = {}
# == Menu System
#
# You can add a navigation menu to be used in your application, or configure a provided menu
#
# To change the default utility navigation to show a link to your website & a logout btn
#
# config.namespace :admin do |admin|
# admin.build_menu :utility_navigation do |menu|
# menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
# admin.add_logout_button_to_menu menu
# end
# end
#
# If you wanted to add a static menu item to the default menu provided:
#
# config.namespace :admin do |admin|
# admin.build_menu :default do |menu|
# menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
# end
# end
# == Download Links
#
# You can disable download links on resource listing pages,
# or customize the formats shown per namespace/globally
#
# To disable/customize for the :admin namespace:
#
# config.namespace :admin do |admin|
#
# # Disable the links entirely
# admin.download_links = false
#
# # Only show XML & PDF options
# admin.download_links = [:xml, :pdf]
#
# end
# == Pagination
#
# Pagination is enabled by default for all resources.
# You can control the default per page count for all resources here.
#
#config.default_per_page = 30
# == Filters
#
# By default the index screen includes a “Filters” sidebar on the right
# hand side with a filter for each attribute of the registered model.
# You can enable or disable them for all resources here.
#
# config.filters = true
end

Resources