Sha256: b7bfd6d9f9cd32a3da01c822facb2c2844390a36447f3493eb62e04ad032af1a

Contents?: true

Size: 810 Bytes

Versions: 16

Compression:

Stored size: 810 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

16 entries across 16 versions & 2 rubygems

Version Path
mongoid-forums-1.0.7 app/controllers/mongoid_forums/redirect_controller.rb
mongoid-forums-1.0.6 app/controllers/mongoid_forums/redirect_controller.rb
ack-mongoid-forums-1.0.5 app/controllers/mongoid_forums/redirect_controller.rb
mongoid-forums-1.0.4 app/controllers/mongoid_forums/redirect_controller.rb
mongoid-forums-1.0.3 app/controllers/mongoid_forums/redirect_controller.rb
mongoid-forums-1.0.2 app/controllers/mongoid_forums/redirect_controller.rb
mongoid-forums-1.0.1 app/controllers/mongoid_forums/redirect_controller.rb
mongoid-forums-1.0.0 app/controllers/mongoid_forums/redirect_controller.rb
mongoid-forums-0.0.11 app/controllers/mongoid_forums/redirect_controller.rb
mongoid-forums-0.0.10 app/controllers/mongoid_forums/redirect_controller.rb
mongoid-forums-0.0.9 app/controllers/mongoid_forums/redirect_controller.rb
mongoid-forums-0.0.5 app/controllers/mongoid_forums/redirect_controller.rb
mongoid-forums-0.0.4 app/controllers/mongoid_forums/redirect_controller.rb
mongoid-forums-0.0.3 app/controllers/mongoid_forums/redirect_controller.rb
mongoid-forums-0.0.2 app/controllers/mongoid_forums/redirect_controller.rb
mongoid-forums-0.0.1 app/controllers/mongoid_forums/redirect_controller.rb