开发者

How do I get /users/new to show up on /static/index

开发者 https://www.devze.com 2023-01-03 14:05 出处:网络
I have two开发者_Python百科 controllers: Users and Static. Static/index is my root index page. I want the Users/new form to be displayed on my index page.

I have two开发者_Python百科 controllers: Users and Static. Static/index is my root index page.

I want the Users/new form to be displayed on my index page.

All forms are working, just no idea how to include the Users form on Static/index.


Something like

# static controller
def index
   # your stuff ...
   @user = User.new
end

def create
   # your stuff ...
   @user.create(params[:user])   
end

# static's index view
# your stuff ...
<% form_for @user do |f| %>
   <%= f.label :name, 'Name' %>:
   <%= f.text_field :name %>
   # more fields
<% end %>
0

精彩评论

暂无评论...
验证码 换一张
取 消