Displaying 5 results from an estimated 5 matches for "forumcontrol".
2008 Jan 12
0
Can't test application controller methods in functional tests?
I have two methods in application controller that I want to test from
ForumController:
-----------------------
class ApplicationController < ActionController::Base
...
def logout
session[:username] = nil
session[:admin] = nil
redirect_to(request.request_uri)
end
...
def home
redirect_to(:controller => ''forum'', :action => ''...
2006 Feb 13
4
activerecord << operator
Hello,
I am new here and actually I am writing my first RoR app.
My question is:
--------
class Topic < ActiveRecord::Base
has_many :messages
end
class Message < ActiveRecord::Base
belongs_to :topic
end
class ForumController < ApplicationController
def post
message = Message.new(params[:message])
@topic = Topic.find(params[:id])
@topic.messages << message
end
end
Okay, this works. However, if i write
message = Message.new(params[:message])
@topic = Topic.fin...
2006 May 31
1
Using caches_action ?
Hi
When I enable action caching in my controller with
caches_action :view_thread
only the first part of my layout template is rendered (up to the yield
statement), and the development.log shows
Processing ForumController#view_thread (for 127.0.0.1 at 2006-05-31
03:13:19) [GET]
Session ID: d6f7ef15f479250fd7e31e252d70f5ff
Parameters: {"action"=>"view_thread", "id"=>"6",
"controller"=>"forum"}
Fragment read: localhost:3006/forum/view_thread...
2006 Apr 28
0
Minimum needed to observe a model
...a model called Post and a observer called PostObserver. I also
have in environment.rb file the line:
config.active_record.observers = :post_observer
I read that observers default to the model with the same name, but the
model class isn''t being observed.
Observe works if I put in the ForumController:
observer :post_observer
But this doesn''t seem right.
Jose
--
Posted via http://www.ruby-forum.com/.
2006 Apr 29
0
Trouble with firefox and AJAX
...while Firefox pops up the ''before''
and ''after'' messages, and then nothing. The server logs show that the
post_view request is received and processed, so I''m stumped as to why
this fails. Any ideas?
Cheers,
Andrew
==== forum_controller.rb ====
class ForumController < ApplicationController
def viewtopic
topic_id = params[:id].to_i
begin
@topic = Topic.find(topic_id)
rescue ActiveRecord::RecordNotFound
flash[:notice] = "This topic does not exist"
redirect_to :action=>:index...