RubyOnRails
Yet another update with no proof! I have worked out many little bugs that were, well, bugging me. The most buggy of them was the tagging. I wasn’t able to display a list of posts by tag if the tag had a space in it. So a tag of “Ruby On Rails” wouldn’t show any posts, but a tag of “RubyOnRails” would (no spaces). So the solution? After some time spent searching through the acts_as_taggable documentation and chatting with some fellow developers on IRC, I found that the following was the problem:
def show_by_tag
@posts = (Post.find_tagged_with(:any => params[:name])).reverse
@tag = params[:name]
end
Here is what I needed:
def show_by_tag
@posts = (Post.find_tagged_with(:any => params[:name], :separator => “+”)).reverse
@tag = params[:name]
end
Note the “:separator => ‘+’”. That is the key. You see when I go looking for a tag, it is listed as “Ruby+On+Rails”, the spaces are replaced with “+” symbols since the browser can’t have spaces in the address bar. So, after I pulled out a great deal of hair, and stayed up way too late I got it working! Yay Me!
Next major step will be testing, getting the code into Subversion for control and getting the new version of this weblog hosted. Keep your fingers crossed.
