Tag Archives: rubyonrails

Phonebook application posted to GitHub

Have taken the application I have been working on for my employer and fully sanitised it to remove any identifying references and posted it at https://github.com/slugbucket/phonebook.

It’s the cleanest copy of the code that I have (including at work) and I will fork a copy to a works Git server and work on further developments from there.

Hopefully, someone might find some use from teh code.

What’s the Rails way?

Right, I finally figured out the way to get tabular data sorted on the index page by way of a non-numeric associated table B, by way of a class method and scope (to limit the selection to the first letter of the name in table A) but it means that my controller needs to check the value the column selection param and run a different query when sorting by that column.

I could add a custom route to the controller and just render the index page. But that will probably mean splitting my session variable processing across different actions.

I guess what I really should do is put all the session processing in the before_action setup method and keep the index and custom actions neat and tidy.

And then there’s the question of the matter of the simple select form to display only items in table A that have a reference to table B as pointed to by the select.

Or perhaps I consider all this as basic search functionality and incorporate into the search actions that I will need to do anyway.

One step at at a time: tidy up the session handling.