Displaying 3 results from an estimated 3 matches for "has_permalink".
2009 Sep 28
7
Basic Rails problem with has_many nil values and permalinks
Hi,
I have a model property with has_many. I find the property and then I
need to find the name of the building or the neighborhood that the
property belongs to. The property is not always assigned a building or
neighborhood.
This becomes a problem when createing permalinks with permalink_fu.
has_permalink [:neighborhood_name, :building_name, :address]
The neighborhood name and building name are defined here in property.rb
def neighborhood_name
neighborhood.name
end
def building_name
building.name
end
If the property does not have a neighborhood or a building, then I get
an e...
2008 Sep 17
0
permalink_fu and classes with different primary_key than id?
Has anyone else had problems with this scenario?
class Team < ActiveRecord::Base
# Primary key
self.primary_key = ''team_id''
has_many :players, :foreign_key => :team_id
has_permalink :city, :param => true
end
I am getting all kinds of trouble - that goes away if I comment out
the has_permalink declaration.
With PermalinkFu:
>> fs = Team.new
=> #<Team team_id: nil, abbr: nil, city: nil, created_at: nil,
updated_at: nil, permalink: nil>
>> fs.team_id =...
2007 Jul 04
0
How to handle plugin dependency
I am trying to use the permalink_fu plugin together with the
acts_as_taggable plugin so my tags will have both a full name (like
COM/OLE) and a permalink suitable for use in a url (like com-ole) so I
can have urls like /article/list/com-ole.
The only snag I have hit is that when I add:
has_permalink :name
to the Tag class definition I get a "method missing" error.
I was able to get it to work by adding:
extend PermalinkFu
to the Tag class defnition and also putting a copy of permalink_fu.rb
in the acts_as_taggable/lib directory.
Is there a better way to do this?
I tried adding:...