本文介绍了无法从种子文件中填充数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Rails 3.2.13、Ruby 1.9.3 和 bigbluebutton.

I am using Rails 3.2.13, Ruby 1.9.3 and bigbluebutton.

Gemfile.rb 包含这些宝石

Gemfile.rb contains these gems

gem 'bigbluebutton-api-ruby', :git => 'git://github.com/mconf/bigbluebutton-api-ruby.git'
gem 'bigbluebutton_rails', :git => 'git://github.com/mconf/bigbluebutton_rails.git'

我在 3 个月前测试了应用程序,在安装包时,安装了 bigbluebutton-api-ruby 版本 1.2.0,安装了 bigbluebutton_rails 版本 1.3.0.

I tested application 3 months before, on bundle install, bigbluebutton-api-ruby version was 1.2.0 was installed and bigbluebutton_rails version 1.3.0 was installed.

现在使用相同的 gem,我将 gem 版本更新为 1.3.0

Now with same gem i am getting both the gem version updated to 1.3.0

我使用 rails 应用程序在 bigbluebutton 中成功创建了我们需要的所有内容.

I successfully created everything with whatever we required in bigbluebutton with rails application.

在我的 seed.rb 中,我放置了以下代码将一些记录插入到 bigbluebutton 服务器表中.

In my seed.rb, i placed following codes to insert some records into bigbluebutton servers table.

BigbluebuttonServer.create(
:name => "Online Education", 
:url => "http://siteurl/bigbluebutton/api", 
:salt => "salt", 
:version => "0.8",
:param => "123123123"
)

我遇到以下错误:

 Faraday::Builder is now Faraday::RackBuilder.
 Connecting to database specified by database.yml
(5.8ms)  SELECT `schema_migrations`.`version` FROM `schema_migrations` 
 rake aborted!
 uninitialized constant ActiveModel::ForbiddenAttributesProtection
 /home/prz/.rvm/gems/ruby-1.9.3-p448/bundler/gems/bigbluebutton_rails-   3bcff964062f/app/models/bigbluebutton_server.rb:4:in `<class:BigbluebuttonServer>'
 /home/prz/.rvm/gems/ruby-1.9.3-p448/bundler/gems/bigbluebutton_rails-3bcff964062f/app/models/bigbluebutton_server.rb:3:in `<top (required)>'
 /home/prz/project/tsxproject/techzoo3.tsxp.0/db/seeds.rb:11:in `<top (required)>'
 /home/prz/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.13/lib/rails/engine.rb:520:in  `load_seed'

这是因为 bigbluebutton 更新了 gem 版本.他们在模型中使用了强参数.现在我该如何解决这个问题.以前我在 Rails 3.2.13 中从未遇到过严重的参数问题.

It is because of gem version updated by bigbluebutton. And they have used strong parameter in model. Now how can i solve this issue. Previous i never faced strong parameter issue with Rails 3.2.13.

等待您的回复.提前致谢.

Waiting for your response. Thanks in advance.

推荐答案

只需将 gem "strong_parameters" 添加到您的 Gemfile 中,它应该可以解决问题.由于您使用的 BigbluebuttonRails 版本现在也使用 resque,我建议您也将 gem "resque" 添加到您的 Gemfile 中.

Just add gem "strong_parameters" to your Gemfile and it should solve the problem.Since the version you're using of BigbluebuttonRails now also uses resque, I'd suggest you add gem "resque" to your Gemfile too.

这篇关于无法从种子文件中填充数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 10:49