Methods
- A
- C
- D
- E
- I
- N
- R
- S
- U
Instance Public methods
create()
Link
Source: show
# File app/controllers/snippets_controller.rb, line 26 def create @snippet = @project.snippets.new(params[:snippet]) @snippet.author = current_user @snippet.save if @snippet.valid? redirect_to [@project, @snippet] else respond_with(@snippet) end end
destroy()
Link
Source: show
# File app/controllers/snippets_controller.rb, line 55 def destroy return access_denied! unless can?(current_user, :admin_snippet, @snippet) @snippet.destroy redirect_to project_snippets_path(@project) end
index()
Link
Source: show
# File app/controllers/snippets_controller.rb, line 18 def index @snippets = @project.snippets.fresh end
new()
Link
Source: show
# File app/controllers/snippets_controller.rb, line 22 def new @snippet = @project.snippets.new end
raw()
Link
Source: show
# File app/controllers/snippets_controller.rb, line 63 def raw send_data( @snippet.content, type: "text/plain", disposition: 'inline', filename: @snippet.file_name ) end
show()
Link
Source: show
# File app/controllers/snippets_controller.rb, line 51 def show @note = @project.notes.new(noteable: @snippet) end
update()
Link
Source: show
# File app/controllers/snippets_controller.rb, line 41 def update @snippet.update_attributes(params[:snippet]) if @snippet.valid? redirect_to [@project, @snippet] else respond_with(@snippet) end end
Instance Protected methods