Class Posting
In: app/models/posting.rb
Parent: ActiveRecord::Base

Project iboard4 Author Andreas Altendorfer Copyright 2009 by Andreas Altendorfer

A Posting has a subject and a body. It belongs to one user and may have many categories as an Categorizable

Methods

Public Instance methods

short title for lists and callback for …ables

[Source]

    # File app/models/posting.rb, line 43
43:   def list_title(n=40)
44:     st = subject[0..n].to_s
45:     st += "..." unless subject.length <= n
46:     st
47:   end

TODO: Check if user allowed to read this posting This callback is used by tagables and therefor it is defined as this simple placeholder yet

[Source]

    # File app/models/posting.rb, line 51
51:   def read_allowed?(user)
52:     true
53:   end

[Source]

    # File app/models/posting.rb, line 55
55:   def rss_body
56:     body.to_s
57:   end

[Source]

    # File app/models/posting.rb, line 26
26:   def tagstring
27:     tags.map(&:name).join(", ")
28:   end

[Source]

    # File app/models/posting.rb, line 30
30:   def tagstring=(newstring)
31:     if self.new_record?
32:       @save_tags = newstring
33:     else
34:       tags.delete_all
35:       newstring.split(",").sort.uniq.each do |t|
36:         tags.create( :tagable_id => id, :tagable_type => self.class.to_s, :name => t )
37:       end
38:     end
39:   end

[Validate]