Class: LinkController
Constant Summary
PaginationHelper::DEFAULT_OPTIONS, PaginationHelper::OPTIONS
Instance Method Summary
collapse
included, #paginate, validate_options!
Instance Method Details
#destroy ⇒ Object
25
26
27
28
|
# File 'app/controllers/link_controller.rb', line 25
def destroy
current_user.links.find(@params['id']).destroy rescue nil
redirect_to_link
end
|
#index ⇒ Object
4
5
6
7
|
# File 'app/controllers/link_controller.rb', line 4
def index
list
render_action 'list'
end
|
#list ⇒ Object
9
10
11
|
# File 'app/controllers/link_controller.rb', line 9
def list
@links = current_user.links || []
end
|
#new ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
|
# File 'app/controllers/link_controller.rb', line 13
def new
@link = current_user.links.build
if @request.post?
@link.attributes = @params['link']
if @link.save
flash['notice'] = "Link was successfully saved."
redirect_to_link
return
end
end
end
|