Hi all,

I have a query about how to access helper methods in a library. I'm
trying to create a custom liquid drop thing which has a form in it (a
poll), and I'm unable to get form_for to work with "vote_poll_path".

Here's my code for the custom drop (this is in a file in lib):

def render(context)
        @vote = Vote.new(:poll_id => @poll.id)
  output = "<div class='poll'><a href='/polls/[EMAIL PROTECTED]'>#
[EMAIL PROTECTED]</a>"
  output += context.capture(form_for @vote, :url =>
context.vote_poll_path(@vote.poll))
  for choice in @poll.choices
      output += "<input type='radio' name='choice_id'' value='#
{choice.id}'>#{choice.description}</input>"
  end
  output += "</div>"
  output += "<input type='submit' value='Vote!' />"
  output += "<% end %>"
end

And here's the error I get:

Liquid error: undefined method `vote_poll_path’ for #

I've watched Railscast episode 132 (helpers outside views) for some
information on how to do this but I'm still stuck. At the end he
mentions @template but I can't get that to work either, it gets
evaluated as nil. I'd be really grateful for any help.

Thanks,

Mark


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to