Skip to content

Commit cfed90b

Browse files
committed
update sample files
1 parent d509497 commit cfed90b

File tree

3 files changed

+53
-55
lines changed

3 files changed

+53
-55
lines changed

code-samples/github-markdown-sample.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Random Article
32
Far far away, behind the word mountains, far from the countries *Vokalia* and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the code of the *Semantics*, a large language ocean.
43
And here is a [link](https://atom.io/themes/flatwhite-syntax)

code-samples/rails-sample.rb

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
class UsersController < ApplicationController
2+
before_filter :correct_user, :only => [:edit, :update]
3+
# before_filter :admin_user, :only => :destroy
4+
5+
def following
6+
@title = "Following"
7+
@title = true
8+
@user = User.find(params[:id])
9+
@users = @user.following.paginate(:page => params[:page])
10+
render 'show_follow'
11+
end
12+
13+
def create
14+
@user = User.new(params[:user])
15+
if @user.save
16+
sign_in @user
17+
redirect_to @user, :flash => { :success => "Welcome to the Sample App!" }
18+
else
19+
@title = "Sign up"
20+
render 'new'
21+
end
22+
end
23+
24+
def edit
25+
@title = "Edit user"
26+
end
27+
28+
def update
29+
if @user.update_attributes(params[:user])
30+
redirect_to @user, :flash => { :success => "Profile updated." }
31+
else
32+
@title = "Edit user"
33+
render 'edit'
34+
end
35+
end
36+
37+
def destroy
38+
@user.destroy
39+
redirect_to users_path, :flash => { :success => "User destroyed." }
40+
end
41+
42+
private
43+
44+
def correct_user
45+
@user = User.find(params[:id])
46+
redirect_to(root_path) unless current_user?(@user)
47+
end
48+
49+
def admin_user
50+
@user = User.find(params[:id])
51+
redirect_to(root_path) if !current_user.admin? || current_user?(@user)
52+
end
53+
end

code-samples/ruby-sample.rb

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,3 @@
1-
class UsersController < ApplicationController
2-
before_filter :correct_user, :only => [:edit, :update]
3-
# before_filter :admin_user, :only => :destroy
4-
5-
def following
6-
@title = "Following"
7-
@title = true
8-
@user = User.find(params[:id])
9-
@users = @user.following.paginate(:page => params[:page])
10-
render 'show_follow'
11-
end
12-
13-
def create
14-
@user = User.new(params[:user])
15-
if @user.save
16-
sign_in @user
17-
redirect_to @user, :flash => { :success => "Welcome to the Sample App!" }
18-
else
19-
@title = "Sign up"
20-
render 'new'
21-
end
22-
end
23-
24-
def edit
25-
@title = "Edit user"
26-
end
27-
28-
def update
29-
if @user.update_attributes(params[:user])
30-
redirect_to @user, :flash => { :success => "Profile updated." }
31-
else
32-
@title = "Edit user"
33-
render 'edit'
34-
end
35-
end
36-
37-
def destroy
38-
@user.destroy
39-
redirect_to users_path, :flash => { :success => "User destroyed." }
40-
end
41-
42-
private
43-
44-
def correct_user
45-
@user = User.find(params[:id])
46-
redirect_to(root_path) unless current_user?(@user)
47-
end
48-
49-
def admin_user
50-
@user = User.find(params[:id])
51-
redirect_to(root_path) if !current_user.admin? || current_user?(@user)
52-
end
53-
end
54-
551
# Ruby test
562

573
require "gem"

0 commit comments

Comments
 (0)