Project

General

Profile

The best way to implement a search for a plugin

Added by Peter Werner about 14 years ago

Hello everybody,

I have developed a plugin for redmine in order to save additional contact information with an issue. I have to admit that I am completely new to Ruby and Rails as well so I needed a lot of reading to get it done. But now I have a plugin to handle my contacts and I can also save them with my issues. There is only one thing left I would like to have but which seems too difficult for my basic knowledge.

In my plugin the action index shows a list of my contacts. Therefore I make only Contact.find(:all) which is O.K. if I have only a few contacts. But not for more than a hundred or so! I have taken therefore a look on the index action of the IssuesController class to get an idea how this filter and paging stuff works. I patched already to be able to filter by my contacts in the issue list.

But after looking into the code I could not get an idea how I can realize the same thing for the index action in my plugin. Basically I would like to have the possibility to select the columns from my contacts table for filtering like one have for the issue list. I do not need the possibility to select the columns which should be displayed because I will always show all columns. Only the filtering is needed.

But what is the best way to do it? I found that term "acts_as_searchable" in the forum but I have to admit that I have not idea what this code is for. Also the QueriesController class is heavy to understand for my. So I would appreciate any advice

Peter


Replies (2)

RE: The best way to implement a search for a plugin - Added by Felix Schäfer about 14 years ago

Peter Werner wrote:

I found that term "acts_as_searchable" in the forum but I have to admit that I have not idea what this code is for.

AAS is for the global search (top right box), so not what you are looking for.

Regarding the rest of the stuff: If you have specific questions, we might be able to answer them, but I don't think you'll get a step by step explanation of how the stuff works, read the code for that ;-)

RE: The best way to implement a search for a plugin - Added by Peter Werner about 14 years ago

Hello Felix,

thank you for your reply. I will try it myself then.

:-)Peter

    (1-2/2)