Sha256: 3e499b8ffe56c47b2f1e5f8b45adb7055a78af21fb66d605a605b5f92bf0212f
Contents?: true
Size: 786 Bytes
Versions: 2
Compression:
Stored size: 786 Bytes
Contents
require_dependency "mongoid_forums/application_controller" module MongoidForums class RedirectController < ApplicationController def forum return redirect_to forum_path(params[:forum_id]) end def topic return redirect_to topic_path(params[:topic_id]) end 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 def subscriptions return redirect_to my_subscriptions_path end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ack-mongoid-forums-1.0.6.1 | app/controllers/mongoid_forums/redirect_controller.rb |
ack-mongoid-forums-1.0.6 | app/controllers/mongoid_forums/redirect_controller.rb |