When I try to visit any page that contains a topic (show, edit, etc
for a given topic), I am getting this:
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.editable_by?
The offending line is in this method:
def authorized?
%w(new create).include?(action_name) || @topic.editable_by?
(current_user)
end
Basically, @topic is nil even though the topic I am trying to view
exists. What's even more curious is that the server reveals that
the :before_filter function that sets the @forum and @topic variables
isn't being called:
Processing TopicsController#show (for 127.0.0.1 at 2010-02-09
13:27:26) [GET]
Parameters: {"forum_id"=>"1-project-board", "id"=>"1-this-is-a-dummy-
project"}
[I18n] loading locale: en from config
[I18n] Locale set to en
User Load (1.2ms) SELECT * FROM "users" WHERE ("users"."id" = 1)
LIMIT 1
NoMethodError (You have a nil object when you didn't expect it!
The error occurred while evaluating nil.editable_by?):
vendor/plugins/community_engine/app/controllers/topics_controller.rb:
118:in `authorized?'
haml (2.2.17) lib/sass/plugin/rails.rb:19:in `process'
There should be a line in there that looks something like " SELECT *
FROM "forums" WHERE ("forums"."id" = 1) LIMIT 1", and something
similar for topics, shouldn't there? This function:
def find_forum_and_topic
@forum = Forum.find(params[:forum_id])
@topic = @forum.topics.find(params[:id]) if params[:id]
end
doesn't look like it is being called.
Any ideas?
--
You received this message because you are subscribed to the Google Groups
"CommunityEngine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/communityengine?hl=en.