简体   繁体   English

带Devise / Simple_Form / Rails 4.0的嵌套表单

[英]Nested Forms with Devise/Simple_Form/Rails 4.0

this is my first post on this forums. 这是我在该论坛上的第一篇文章。 First of all here is what I use for my project. 首先,这是我用于项目的内容。

Simple_Form: 3.0.0 Devise: 3.2.2 Rails: 4 Ruby: 2 Bootstrap: 3.0.3 Simple_Form:3.0.0 Devise:3.2.2 Rails:4 Ruby:2 Bootstrap:3.0.3

I have a User model (from devise) and a part_order model (which has user_id as index), i set the user_id value in part_order create method like this '@part_order.user_id = current_user.id' not sure if its proper but it works fine. 我有一个User模型(来自devise)和part_order模型(具有user_id作为索引),我在part_order create方法中设置了user_id值,例如“ @ part_order.user_id = current_user.id”,不确定它是否正确,但是可以精细。

Here is the problem: 这是问题所在:

The client wants an unregistered user to make a part order (create a part_order) and sign up (create a user)/ sign in (if he already an account) in the same page. 客户希望未注册的用户在同一页面上进行零件定单(创建part_order)并注册(创建用户)/登录(如果他已经有帐户)。 I know that it has to do something with nested forms and attributes. 我知道它必须对嵌套的表单和属性进行处理。

I am in early stage of the project so i didn't make any changes on the code (after the gems' installation). 我处于项目的早期阶段,因此(在gems安装之后)我没有对代码进行任何更改。

Thanks in advance! 提前致谢!

check out this railscast which shows how to implement guest users 看看这个railscast,它显示了如何实现访客用户

http://railscasts.com/episodes/393-guest-user-record http://railscasts.com/episodes/393-guest-user-record

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM