Displaying 2 results from an estimated 2 matches for "message_thread".
2009 May 12
2
2.3 Nested Model Forms; build new without updating existing
...sting messages - just a need to add new messages.
Does anybody know how to do this? Code is below.
Models:
class MessageThread < ActiveRecord::Base
has_many :messages
accepts_nested_attributes_for :messages, :allow_destroy => true
end
class Message < ActiveRecord::Base
belongs_to :message_threads
end
View (show.html.erb)
<% @message_thread.messages.each do |message| %>
<%= message.message %>
<% end %>
<% form_for @message_thread do |thread_form| -%>
<% thread_form.fields_for :messages do |message| %>
<%= message.label :message %>
<%= me...
2008 Jan 12
0
Can't test application controller methods in functional tests?
....dirname(__FILE__) + ''/../test_helper''
require ''forum_controller''
# Re-raise errors caught by the controller.
class ForumController; def rescue_action(e) raise e end; end
class ForumControllerTest < Test::Unit::TestCase
#add fixtures:
fixtures :messages, :message_threads, :message_boards, :forums
def setup
@controller = ForumController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
end
...
# test logout (all cases)
def test_logout
get :logout, nil, nil
assert_response :success
a...