Displaying 9 results from an estimated 9 matches for "newscontroller".
Did you mean:
new_controller
2006 Dec 10
5
model-controller-paradigm: What about admin controllers?
Hi all
We all know the model-controller-paradigm: I have a model "News" which
has a corresponding CRUD-controller "NewsController".
But now I''m quite unsure about the following...
Guess we have normal visitors that visit our site www.??.com/news and we
have administrators that create and modify news items.
The admin should see an "Edit" link and a "Destroy" link corresponding
to every news...
2006 Feb 01
3
Testing components
...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 = ActionController::TestResponse.new
end
# Replace this with your real tests.
def te...
2006 May 08
2
Noob Question - Variable Scope
I feel awful asking such a basic question, but here it goes....
I have a controller, "NewsController".
The user enters and the "list" action is called and I populate an
instance variable "@news" which contains all the elements I''d like to
display using a form.
The user then changes something and the "update" action is called.
Is "@news" st...
2009 Nov 11
6
HeLp oN my database
Using my application i can able to save a new record into my db
but i cannot update a existing record into my db.
using update query i can able to update my records.
but using update_attributes it doesnot update my records.
even i cant find any errors in logs or something.
throughout my application i can able to save a new record but unable to
update my existing records.
actually i have changed
2006 Dec 20
4
undefined method `fullname' for #<User:0x357e380>, BUT works on first view?
...ciated :user
validates_length_of :title, :description, :minimum => 5, :allow_nil
=> false
acts_as_commentable
acts_as_taggable
def self.find_recent
News.find(:all, :order => ''created_at'', :limit => 10).reverse
end
end
and a controller like this:
class NewsController < ApplicationController
def show
begin
@news = News.find(params[:id])
rescue ActiveRecord::RecordNotFound
flash[:notice] = "News item not found!"
redirect_to :action => ''index'' and return
else
@comments = @news.comments
en...
2006 Aug 17
1
Disable rendering of layout using a GET parameter?
Hi all
Is there some sort of a built-in possiblity to disable the rendering of
the layout using a GET parameter?
Something like
:url_for :controller => :news, :action => :show, :id => news_item,
:layout => false
This should construct something like that:
/news/show/123&layout=false
And automatically the layout wouldn''t be rendered. Is this already
built-in, or
2006 Jun 09
0
Controller Modules Messed Me Up
...ndex 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
find( :all,
:condi...
2006 May 17
3
WebServices: execution expired
...and I can''t got explanation why I have "execution expired"
when I trying to test this web service:
Pointed to: http://localhost:3000/news/list
class NewsService < ActionWebService::Base
web_service_api NewsApi
def list
[NewsTopic.new, NewsTopic.new]
end
end
class NewsController < ApplicationController
wsdl_service_name ''news''
web_service_dispatching_mode :delegated
web_service :news, NewsService.new
def list
news = ActionWebService::Client::Soap.new(
NewsApi, "http://localhost:3000/news/news")
rsp = news.list
rend...
2006 Mar 20
24
Newbie Question about Custom Classes
Sorry if this is a complete newbish question, but I''m trying to wrap
my head around creating custom classes in my rails webapp. I''m
normally a Java developer, but I figured I''d give RoR a try and see
how I like it, and whether it would be useful for production use with
a new client.
Anyways, what are the best practices for custom classes? Where and/or
how do I create