Skip to content

Instantly share code, notes, and snippets.

View marcelloma's full-sized avatar

Marcello Albuquerque marcelloma

View GitHub Profile
@marcelloma
marcelloma / sections_controller.rb
Created May 24, 2011 18:03
decent_exposure + meta_search + cancan
class SectionsController < ApplicationController
load_and_authorize_resource
expose(:section)
expose(:sections) { search.paginate(:page => params[:page]) }
expose(:search) { Section.search(params[:search]) }
def create
if section.save
require 'spec_helper'
describe User do
describe "other_users" do
before {
User.delete_all
@me = Factory(:user)
@other_one = Factory(:user)
@other_two = Factory(:user)
describe User do
describe "other_users"do
it "should return other users" do
User.delete_all
me = Factory(:user)
other_one = Factory(:user)
other_two = Factory(:user)
User.other_users(me).all.should_not be_empty