I have added the following to model:

class RecipesController < ApplicationController
  show_action :toggle_favourite do
      return "!!"
  end


can you tell me how to set <update-button> to call this from a <def
tag="card" for="Recipe">?

I tried to use <update-button label="Toggle favourite"
params="&{:toggle_fav_only=>true}" update="self"
method="toggle_favourite"/>, but get "Routing error. No route matches"
as a result of ajax request once I push the button

if I change <update-button> to <remote-method-button> with all the
same parameters, error will be "no such web method 'toggle_favourite'
on recipe:1" at the stage of rendering a page

which method it's calling?? why it doesn't reach
Recipe::toggle_favourite() ?

On 10 фев, 03:46, Ankur <[email protected]> wrote:
> You can make a custom controller action and set that to the URL for
> the update-button.  You will have to set the params on the update-
> button.
>
> On Feb 9, 5:44 pm, Vadim Lazuko <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hi Ankur,
>
> > yes, I already have a has_many :through - you can see it at initial
> > posting.
>
> > My question now is how to connect client side: <update-button
> > label="Add to favourites" ...> with a User model where I could add an
> > action doing similar to what you say "@user.recipe_favourite <<
> > params[:recipe]"
>
> > ... hmmm, i'm little lost between coding and hobomagic
>
> > On 10 фев, 00:17, Ankur <[email protected]> wrote:
>
> > > I believe you already have the has_many :through setup.  Are you
> > > asking how to add to the user a favorite recipe?  Should be simple:
>
> > > Maybe you had a different question?
>
> > > On Feb 9, 4:07 pm, Vadim Lazuko <[email protected]> wrote:
>
> > > > Hi!
>
> > > > Lifecycles does not fit logically being something more like subprocess
> > > > of one object while my case is pure many-to-many relationship
>
> > > > i see that the only way is to create a controller action for the user
> > > > model and pass a recipe as a parameter to handle attach/detach from
> > > > the favourites' list
>
> > > > can you give me an example of code to deal with 'has_many ... :through
> > > > =>...' ?

-- 
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