added security type models, improved cashflow, bug- and layout fixes along the way
[smr.git] / gui / app / models / news_item.rb
blob9523579aa2f361bfb38be74076942ece7c7cfafd
2 # This file is part of SMR.
4 # SMR is free software: you can redistribute it and/or modify it under the
5 # terms of the GNU General Public License as published by the Free Software
6 # Foundation, either version 3 of the License, or (at your option) any later
7 # version.
9 # SMR is distributed in the hope that it will be useful, but WITHOUT ANY
10 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License along with
14 # SMR.  If not, see <http://www.gnu.org/licenses/>.
16 class NewsItem < ActiveRecord::Base
17         belongs_to :NewsFeed, :foreign_key=>'id_news_feed'
18         has_many   :NewsAssign
20     ##
21     # Wrapper to convert integer date_* column to Time and vice versa.
22     # If :integer is given, the date_* field is updated first. The Time
23     # value is always returned.
24     def time_fetched=(string)
25         write_attribute(:fetched, string.to_time)
26     end
27     def time_fetched
28         Time.at read_attribute(:fetched)
29     end
30 end