Rails:使用变量创建记录
我想要 4 组不同的数据: 创造, 更新, 我想使用
变量对每个函数使用一个操作,但无法使其工作。
例如:
def create
@type = params['type'] # use an outside ajax request to decide type
@type.create(:title => 'new title') # create a new table using that type
end
I have 4 different groups of data that I want to:
create,
update,
delete
I want to use one action for each function, using a variable, but can't get it to work.
For example:
def create
@type = params['type'] # use an outside ajax request to decide type
@type.create(:title => 'new title') # create a new table using that type
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您尝试过
constantize
吗?Have you tried
constantize
?