Hooks and forms

5 views
Skip to first unread message

oleg dashevskii

unread,
Jan 18, 2011, 3:58:38 AM1/18/11
to Spree
Hi all,

I'm trying to use :signup_inside_form hook in my extension (Spree
0.40.2).

It's introduced like this in spree_auth:

<%= form_for(:user, :url => registration_path(@user)) do |f| %>

<%= hook :signup_inside_form do %>
<%= render 'shared/user_form', :f => f %>
<p><%= submit_tag t("create"), :class => 'button primary' %></
p>
<% end %>

<% end %>

In my replacement I need "f" variable, which corresponds to the form
builder. But if I just use

class UserContactInfoHooks < Spree::ThemeSupport::HookListener
replace :signup_inside_form, :partial => 'shared/registration'
end

...my partial doesn't get "f" as a local. How could one do this?

Sure, there's a way to completely override the form, but I'm
interested if a cleaner solution exists.

CvX!

unread,
Jan 18, 2011, 12:12:10 PM1/18/11
to Spree
Hi. I believe that f should be passed to hook like this:

<%= hook :signup_inside_form, { :f => f } do %>

Guess it should be patched.
Reply all
Reply to author
Forward
0 new messages