Skip to content

Instantly share code, notes, and snippets.

View brentd's full-sized avatar

Brent Dillingham brentd

  • Asheville, NC
View GitHub Profile
# See ActionController::RequestForgeryProtection for details
# Uncomment the :secret if you're not using the cookie session store
protect_from_forgery # :secret => '76442f0e40a981d5e2b791b320bd8e94'
def must_be_admin
redirect_to '/' unless self.current_user.in_role?("admin")
flash[:notice_error] = "Access Denied..." unless self.current_user.in_role?("admin")
end
-if has_permission?("people")
%h2 People
=render :partial => 'people/list'
-if has_permission?("organizations")
%h2 Organizations
=render :partial => 'organizations/list'
-if has_permission?("projects")
%h2 Projects
-if has_permission?("people")
%h2 People
=render :partial => 'people/list'
-if has_permission?("organizations")
%h2 Organizations
=render :partial => 'organizations/list'
-if has_permission?("projects")
%h2 Projects
-for model in MODEL_TYPES
-if can_view?(model)
%h2= model.pluralize
=render :partial => "#{model.tableize}/list"
diff --git a/lib/searchlogic/named_scopes/conditions.rb b/lib/searchlogic/named_scopes/conditions.rb
index 31d0643..c0c1d8e 100644
--- a/lib/searchlogic/named_scopes/conditions.rb
+++ b/lib/searchlogic/named_scopes/conditions.rb
@@ -30,7 +30,9 @@ module Searchlogic
BOOLEAN_CONDITIONS = {
:null => [:nil],
:not_null => [:not_nil],
- :empty => []
+ :empty => [],
diff --git a/lib/searchlogic/named_scopes/conditions.rb b/lib/searchlogic/named_scopes/conditions.rb
index 8329957..52faa82 100644
--- a/lib/searchlogic/named_scopes/conditions.rb
+++ b/lib/searchlogic/named_scopes/conditions.rb
@@ -122,7 +122,7 @@ module Searchlogic
when "blank"
{:conditions => "#{table_name}.#{column} = '' OR #{table_name}.#{column} IS NULL"}
when "not_blank"
- {:conditions => "#{table_name}.#{column} != '' OR #{table_name}.#{column} IS NOT NULL"}
+ {:conditions => "#{table_name}.#{column} != '' AND #{table_name}.#{column} IS NOT NULL"}
diff --git a/lib/culerity/celerity_server.rb b/lib/culerity/celerity_server.rb
index c89e2d7..d2eb5c7 100644
--- a/lib/culerity/celerity_server.rb
+++ b/lib/culerity/celerity_server.rb
@@ -69,7 +69,8 @@ module Culerity
def proxify(result, in_array = false)
if result.is_a?(Array)
- result.map {|x| proxify(x, true) }.inspect
+ values = result.map {|x| proxify(x, true) }
~ → mkdir project_with_bundled_json
~ → cd project_with_bundled_json
~/project_with_bundled_json → echo "gem 'json'" > Gemfile
~/project_with_bundled_json → gem bundle
Calculating dependencies...
Updating source: http://gems.rubyforge.org
Downloading json-1.1.9.gem
Installing json-1.1.9.gem
Building native extensions. This could take a while...
Done.
class Card
include Comparable
attr_reader :rank
FACE_CARDS = {
'ace' => 1,
'jack' => 11,
'queen' => 12,
'king' => 13
}
class A
@foo = "bar"
def self.foo
@foo
end
def foo
self.class.foo
end