Displaying 4 results from an estimated 4 matches for "news_control".
2006 Feb 01
3
Testing components
...and am really happy with the way it''s going. Unfortunately, all my
attempts at writing functional tests for them fail. Trying to duplicate
my normal controller tests I have:
require File.dirname(__FILE__) + ''/../test_helper''
require File.dirname(__FILE__) + ''news_controller''
# Re-raise errors caught by the controller.
class NewsController; def rescue_action(e) raise e end; end
class NewsControllerTest < Test::Unit::TestCase
def setup
@controller = NewsController.new
@request = ActionController::TestRequest.new
@response = ActionCont...
2006 Jan 31
3
Lost in routing
I''m trying to create a modules based system where my controllers are
all under modules. So the structure looks something like:
app/
controllers/
message/
news_controller.rb
email_controller.rb
library
books_controller.rb
pictures_controller.rb
home_page_controller.rb
Each of those controller has it''s own view, and there''s a central
application.rhtml for the layout. The layout has in it l...
2007 Jul 19
7
NoMethodError in partial driving me mad
...ntry.
in my controller there are the actions show and show_category.
if the "show" action is called, a single news item is rendered through
my partial with no errors.
if the "show_category" action is called, i get a NoMethodError while
displaying my news through the partial.
news_controller.rb:
---------------------------------
def show
@news = News.find(params[:id])
render_partial ''news''
end
def show_category
@news = NewsCategory.find(params[:id]).news
render_partial ''news'', :collection => @news
end
_news.rhtml:
---...
2006 Jun 09
0
Controller Modules Messed Me Up
...o it all again with news/index for the public
and admin/news/index for the administrators. Everything set up fine
with the generator and scaffold for adding news in the admin area.
However now I can''t get the public area to show the list of news. Here
is what I did:
/app/controllers/news_controller.rb
class NewsController < ApplicationController
def Index
@news = News.news_items
end
end
/app/models/news.rb
class News < ActiveRecord::Base
validates_presence_of :date_added, :date_live, :news_date, :added_by,
:headline, :summary, :article
def self.news_items
fi...