简体   繁体   English

Rails在Ruby on Rails中生成模型错误

[英]Rails Generate model error in Ruby on Rails

I am building a new RoR app and i had tried to create a new model like below. 我正在构建一个新的RoR应用程序,并且我试图创建一个如下所示的新模型。

rails generate model Pic title:string description:text

But I keep on getting these errors always and I tried installing many methods like installing gems ,updated the gems etc. 但是我总是不断遇到这些错误,我尝试安装许多方法,例如安装gems,更新gems等。

PS : I am trying install the older version of the gems. PS:我正在尝试安装较旧版本的gem。 Is that creating a problem? 这是一个问题吗?

But none of it gave me the results. 但是没有一个给我结果。 Please help me with this. 请帮我解决一下这个。

在此处输入图片说明

PPS : I am an absolute beginner to ruby. PPS:我绝对是红宝石的初学者。 So please help me by giving solution with good reason. 因此,请通过充分的理由提供解决方案来帮助我。 Thanks in Advance. 提前致谢。

Hi seems like you have issues with your simple_form gem,try to remove from gem file and add gem 'simple_form' and run bundle install after this step run rails generate simple_form:install for creating config file for simple form. 你好好像你有你的simple_form宝石的问题,试图从宝石文件中删除,并添加宝石“simple_form”并运行捆绑安装这一步运行轨道产生simple_form:安装简单的形式创建配置文件。 Try this it may help you out. 试试这个可能会帮助您。

As @Navneet pointed out generating a config file can also be used for configuration and it also works pretty well. 正如@Navneet指出的那样,生成配置文件也可以用于配置,并且效果也很好。

Another thing i found was , Here the gems used were older version. 我发现的另一件事是,这里使用的宝石是旧版本。 That created a compatibility issue (since it was not configured accordingly). 这就造成了兼容性问题 (因为没有进行相应的配置)。 So by replacing the gems with current version or stable ones , you can get rid of this problem. 因此,通过将宝石替换为当前版本或稳定版本,您可以摆脱此问题。

  1. Go to rubygems.org 转到rubygems.org
  2. Search for the gems and check whether its the latest version 搜索宝石并检查其最新版本
  3. If not, Replace the line of corresponding gem in Gemfile with newest one. 如果没有, Gemfile用最新的Gemfile替换对应的gem行。

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

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