For 1: I believe you can use update-button and in the parameters you can give the give the attributes you want to set in the user. You may have to create a new controller method, otherwise when you render the button and you add current favorites to the parameters with the extra one, it may update ok, but if you do ajax, the other recipes will overwrite it. So maybe better to have a new controller which will just add a recipe to favorites (if it doesn't exist)
On Feb 9, 5:24 am, Vadim Lazuko <[email protected]> wrote: > I've extended the tutorial example and now have following models: > > class User > has_many :recipes > > has_many :recipe_favourite, :class_name => "Recipe", :through > => :user_recipe_favourites > has_many :user_recipe_favourites > > class Recipe > belongs_to :user, :creator => true > > has_many :user_likes, :class_name => "User", :through > => :user_recipe_favourites > has_many :user_recipe_favourites > > class UserRecipeFavourite > belongs_to :user > belongs_to :recipe > > Straight User-Recipe relationship is to store ownership, while > user_recipe_favourites to stores all recipes which user likes from > others. > > I want: > 1. create a single button, which will be shown at recipes which do not > belong to this user and which will toggle adding this particular > recipe to acting_user's favourites list > 2. add a table with favourite recipes to a user's account page > > Can you advise me how to create this? -- 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.
