Displaying 2 results from an estimated 2 matches for "added_by".
2006 Dec 24
8
HABTM Reading Rows From Two Tables
I''m a newbie and loving rails but I''m stuck.
All I want to do is to be able to show in my "list.rhtml" view the
information between two tables who both have a HABTM relationship. So
this is what I have as follows.
--------------------------
TABLES
--------------------------
# Projects
create_table "projects", :force => true do |t|
t.column
2006 Jun 09
0
Controller Modules Messed Me Up
...w 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,
:conditions => "news_date <= now()",
:order => "news_date desc")
end
end
/app/views/news/index.rhtml
<h1>Recent News</h1>
<% for news in @news...