I would like to pass the url to a form, which is in a partial. However, the current setup generates an error message:
SyntaxError in OrganizationsController#new
syntax error, unexpected keyword_do, expecting keyword_end ...or(@organization), url="url" do |f| @output_buffer.safe_appe... ...
The error highlights the 3rd line of the partial/form which is <%= form_for(@organization), url="url" do |f| %>
Two views both use the partial/form, and to this end include:
## View1:
<%= render 'registrationform', local:{url: signup_checkout_path} %>
## View2 (url should point to `def create` in organizations controller):
<%= render 'registrationform', local:{url: organizations_path} %>
Routes includes:
resources :organizations
post 'signup/register' => 'organizations#checkout', as: 'signup_checkout'
And the partial registrationform includes:
<% if local_assigns.has_key? :url %>
<%= form_for(@organization), url="url" do |f| %>
...
<% else %>
????
<% end %>
Def new
in the controller:
def new
if (logged_in?)
flash[:danger] = "You're already logged in"
redirect_to root_url
end
@organization = Organization.new
@member = @organization.members.build
end