I think that I would get better results if I tried to do this at three pm
instead of three am!
Ok, I got it working, but it feels equally kludgy:
thufir@arrakis ~/Desktop/strawr $
thufir@arrakis ~/Desktop/strawr $ cat app/helpers/application_helper.rb
# Methods added to this helper will be available to all templates in the
application.
module ApplicationHelper
def select_category
# select :category, :id, Category.some_find_method.collect {|c|
[ c.category, c.id ]}
select :category, :id, Category.find(:all).collect {|c|
[ c.category, c.id ]}
end
end
thufir@arrakis ~/Desktop/strawr $
thufir@arrakis ~/Desktop/strawr $ tail app/views/feeds/show.rhtml --
lines=1
<%= select_category %>
thufir@arrakis ~/Desktop/strawr $
However, that achieves the purpose. I think what bothers me, slightly,
is the complexity of the compound line in the select_category method. I
can read it, sorta, but can't write it
However, I'll live
Oh, now I get it. I must be tired. I need to define a few
"some_find_method"'s, like: categories linked to this feed, categories
not linked to this category, etc. These methods are in the same module?
I was thinking of refining the query from all records to just those
records which are linked to the particular object. However, since I have
trouble writing that in English, I'll take a pass and come back to that.
I would like have two buttons: "link" and "unlink".
When "link" is clicked then a row the "tags" table (horrible name) is
created with the feeds_id and categories_id values. (If it creates the
same relationship ten times, that's ok for now). The unlink would delete
the corresponding row from the "tags" table.
I followed the Apple demo and created Google Code Archive - Long-term storage for Google Code Project Hosting.
expenses/ , which has buttons kind-of along this line. However, it's a
one-to-many wheras I want a many-to-many. Plus, I think that the Apple
tutorial is more than a little dated.
Just thinking outloud. What kind of button would be sufficient for what
I describe? I'm a bit more confident with how the show.rhtml interacts
with methods, but: which method in which class for a "submit" type
button? where does the button go?
Just thinking out loud, and will be googling tomorrow
-Thufir