Question: I was wondering if i can to make url such like this:

```
http://www.google.com/index.php?id=mycustomsearch,javascript:onload=initfunction1();

```

To make myself clear i'll explain.
I want to modify the link to make a javascript action.
To be able to give the same exact page but triger every time another function based on the link.

I wrote [,] just for demonstration. I dunno if there is a way to do it.

Answer: 
Both work; however, personally, I prefer a has\_many :through relationship. The reason being is you have access to the join table. To do this generate a model called `ticket_user` with a field called `user_id` and `ticket_id`. Then in the model add

```
belongs_to :user
belongs_to :ticket

```

then you can add to the ticket model

```
has_many :ticket_users
has_many :users :through ticket_user

```

and this to the user model

```
has_many :ticket_users
has_many :ticket :through ticket_user

```

Then to retrieve all of a users tickets do

```
user.tickets

```

To get all of a tickets users do

```
ticket.users

```

For more info check out this [guide](http://guides.rubyonrails.org/association_basics.html)
In your case has\_and\_belongs\_to\_many is the extra relationship.

```
has_and_belongs_to_many :members, :class_name => "User", :join_table => "members_tickets"

```

You can have to create one table members\_users with ticket\_id and member\_id as fields as shown in <http://guides.rubyonrails.org/association_basics.html#choosing-between-has_many-through-and-has_and_belongs_to_many>

now you can get list of assigned members like below

```
@ticket.members # list of members
@ticket.members << @user # add new member

```