On Mar 22, 2010, at 1:56 PM, Donald R. Ziesig wrote:

I am still trying to get a trivial web site up where the individual users have no connection with each other (an overriding requirement). Matt Jones helped with my first problem (separating the data at creation time) as shown below with his reference to #creator. Unfortunately, each user sees "stuff" which can be connected to other users as follows:

Users create log entries which are their business only. When looking at the log entries, User 1, who has entered 2 log entries and User 2, who has entered 1 log entry see log entry tabs as follows:


(for User 1):

There are 3 Log Entries:  << but he only made two entries

Log Entry 1
User 1

Log Entry 3         << what happened to entry 2?
User 1

(for User 2):

There are 3 Log Entries    << but she only made one entry

Log Entry 2      << what happened to entry 1?
User 2


In both cases, the individual users can tell that there are other users and which Log Entries have been assigned to them..

I would like the individual users to have separate counts and ind ices for their own log entries.

Is this a bug? If not, can anyone recommend a work-around so I can meet my requirements?


The first part is because the default hobo_index action grabs *all* the LogEntry records, but only shows the ones that the current user can view, thus the difference between the displayed count and the records.

An easy fix for this is in the controller:

def index
  hobo_index current_user.log_entries
end

This will correctly find *only* the entries attached to the current user. Pagination and everything else should continue to work as usual.

As has already been pointed out, the "Log Entry 2" and so on are the default names generated by Hobo's card tag (it falls back to a model name / ID combo when nothing else is defined). You'll likely either want to define a 'name' method on LogEntry, redefine the card tag to behave correctly, or switch to an entirely different style of display (see Agility for an example of using table-plus).

However, all of these solutions will still show the IDs as part of the URLs for the show pages, amongst other places. There *are* solutions to avoid this, most notably switching to a GUID-based primary key. I've not heard of anyone trying this, so you might be the first. However, you may also want to think about how much "leakage" is appropriate; after all, even Apple assigns order numbers sequentially (witness the estimates of the iPad preorder obtained this way).

Hope this helps!

--Matt Jones

--
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to