Skip to content

Instantly share code, notes, and snippets.

@pelletier
Created October 27, 2010 21:27
Show Gist options
  • Save pelletier/650049 to your computer and use it in GitHub Desktop.
Save pelletier/650049 to your computer and use it in GitHub Desktop.
class SourcesController < ApplicationController
before_filter :authenticate_user!
protected
def load_sources
@sources = current_user.sources
end
def index
load_sources
#@sources = Source.all(:conditions => {:user => current_user.id})
end
def create
@source = current_user.sources.build
if @source.save
redirect_to [:sources], :notice => "New source successfully added."
else
load_sources
render "index"
end
# respond_to do |format|
# format.html { redirect_to :action => :index }
# format.js
# end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment