Skip to content

Instantly share code, notes, and snippets.

@joerixaop
joerixaop / README.md
Last active August 29, 2015 14:10 — forked from botandrose/README.md
@joerixaop
joerixaop / application.js
Created September 4, 2011 21:53 — forked from spint/application.js
Build up jQuery-UI dialogs on the fly
// Creates a jQuery UI dialog on the fly, every time a link .user-link is clicked,
// dialog content will be loaded from the url specified by the clicked link
$(function(){
$(".user-link").live('click', function(){
var link = $(this);
$("<div><img src='" + BASEPATH + "images/small-spinner.gif' /> </div>")
.dialog({
autoOpen: true, //for info, true is default
modal: true,
# this only gets cached in @admin if true
# how to cache this also in case of false?
def admin?
@admin ||= has_role? 'admin'
end
#is the following ok?
class LowCoverReport < ActiveRecord::Base
# The other solution would fail for an empty list of countries
# If you don't need it you also can leave out the class variable
country_query = lambda{|o| {:conditions => ["country_id IN (?)", o.countries]} }
named_scope :for_user, country_query
named_scope :for_session, country_query