mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-29 21:38:49 +01:00
small improvements
render :partial => filename, :object => @object can be written shorter since rails 2.0 like render :partial => @object or render :partial => @collection Also form_for is smart bout put and post for update and creation. it helps watching older railcasts episodes :-)
This commit is contained in:
parent
edb3668dba
commit
484356fe07
15 changed files with 51 additions and 52 deletions
|
|
@ -18,13 +18,7 @@ class NotesController < ApplicationController
|
|||
@page_title = "TRACKS::Note " + @note.id.to_s
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.m &render_note_mobile
|
||||
end
|
||||
end
|
||||
|
||||
def render_note_mobile
|
||||
lambda do
|
||||
render :action => 'note_mobile'
|
||||
format.m { render :action => 'note_mobile' }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -49,16 +43,6 @@ class NotesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@note = current_user.notes.find(params['id'])
|
||||
@note.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js { @down_count = current_user.notes.size }
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@note = current_user.notes.find(params['id'])
|
||||
@note.attributes = params["note"]
|
||||
|
|
@ -69,11 +53,20 @@ class NotesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@note = current_user.notes.find(params['id'])
|
||||
@note.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js { @down_count = current_user.notes.size }
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def set_source_view
|
||||
@source_view = params['_source_view'] || 'note'
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue