Class: MongoidForums::RedirectController

Inherits:
ApplicationController show all
Defined in:
app/controllers/mongoid_forums/redirect_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_ability

Instance Method Details

#forumObject



6
7
8
# File 'app/controllers/mongoid_forums/redirect_controller.rb', line 6

def forum
    return redirect_to forum_path(params[:forum_id])
end

#postsObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/mongoid_forums/redirect_controller.rb', line 14

def posts
    post = Post.find(params[:post_id])
    return redirect_to root_path, :notice => "Post does not exist" if post.topic == nil
    x = 0

    posts = post.topic.posts

    posts.each_with_index do |p, i|
        x = i
        break if p.id == post.id
    end
    return redirect_to topic_url(post.topic, :page => (x / MongoidForums.per_page) + 1) + "#" + post.id.to_s
end

#subscriptionsObject



28
29
30
# File 'app/controllers/mongoid_forums/redirect_controller.rb', line 28

def subscriptions
    return redirect_to my_subscriptions_path
end

#topicObject



10
11
12
# File 'app/controllers/mongoid_forums/redirect_controller.rb', line 10

def topic
    return redirect_to topic_path(params[:topic_id])
end