Class Category
In: app/models/category.rb
Parent: ActiveRecord::Base

Project iboard4 Author Andreas Altendorfer Copyright 2009 by Andreas Altendorfer

Simple model which can be attached to any "Categorizable"

Methods

Public Instance methods

[Source]

    # File app/models/category.rb, line 18
18:   def add_new_permalinks
19:     unless @new_permalink.blank?
20:       pl = self.permalinks.build(:url => @new_permalink)
21:       self.permalink_ids << pl
22:     end
23:   end

short title for lists and callback for …ables

[Source]

    # File app/models/category.rb, line 39
39:   def list_title(n=40)
40:     st = name[0..n].to_s
41:     st += "..." unless name.length <= n
42:     st
43:   end

[Source]

    # File app/models/category.rb, line 30
30:   def new_permalink=(newlink)
31:     if Permalink.find_by_url(newlink)
32:       @permalink_exists_error = true
33:     else
34:       @new_permalink = newlink
35:     end
36:   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/category.rb, line 48
48:   def read_allowed?(user)
49:     true
50:   end
title(n=40)

Alias for list_title

[Source]

    # File app/models/category.rb, line 25
25:   def user
26:     @user ||= User.find_by_is_admin(true)
27:   end

[Validate]